
|
If you were logged in you would be able to see more operations.
|
|
EJB Cartridge
Created: 06/Oct/04 09:45 AM
Updated: 06/Oct/04 09:45 AM
|
|
| Component/s: |
None
|
| Affects Version/s: |
None
|
| Fix Version/s: |
None
|
|
|
Environment:
|
Win2k, Java 1.4.2, andromda snapshot of 3rd of october
|
|
No fields are created when using a stateful session bean and the ejb cartridge. Here is my example:
I used a simple SessionBean, called "MyService", added the stereotype "Service" and added a field called "name" of the type "String" (just in case my little image is not readable).
+------------------------+
| << Service>> |
| MyService |
+------------------------+
| - name:String |
+------------------------+
AndroMDA will generate 5 files for that. The problem can be found in the MyServiceBean class as it tries to set "this.test = test" inside the create method without any attribute test being defined. Here is the source code (I removed some comments):
+--------------- start of MyServiceBean -----------------------------
package de.test;
public abstract class MyServiceBean implements javax.ejb.SessionBean {
// ----------- constant definitions -----------
// -- accessors for environment entries --
// -- accessors for constants --
// --------------- attributes ---------------------
// ---------------- business methods ----------------------
// ---------------- create methods --------------------
/**
* @ejb.create-method
* @ejb.transaction type="Required"
*/
public void ejbCreate() throws javax.ejb.CreateException {
}
public void ejbPostCreate() throws javax.ejb.CreateException {
}
/**
* Create method with all attribute values.
* @param name Value for the name property
* @ejb.create-method
* @ejb.transaction type="Required"
*/
public void ejbCreate(java.lang.String name)
throws javax.ejb.CreateException
{
this.name = name;
}
public void ejbPostCreate(java.lang.String name) throws javax.ejb.CreateException {
}
}
--------------- end of source -----------------------------+
I already posted this to the mailing list where wouter suggested to change the following in the SessionBean.vls template:
#set ($instanceAttributes = $service.type.instanceAttributes) (line #162)
should be changed to:
#set ($instanceAttributes = $service.instanceAttributes)
This works fine for me.
|
|
|
There are no comments yet on this issue.
|
| |
|
|