Message:
The following issue has been closed.
Resolver: Sascha-Matthias Kulawik
Date: Fr, 10 Sep 2004 10:52 AM
should work with the actual CVS.
---------------------------------------------------------------------
View the issue:
http://team.andromda.org:8080/jira/browse/EJB-2
Here is an overview of the issue:
---------------------------------------------------------------------
Key: EJB-2
Summary: [EntityBeans] generated ejbCreateImpl() method contains error
Type: Bug
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: EJB Cartridge
Assignee: Sascha-Matthias Kulawik
Reporter: Stefan Siegl
Created: Mi, 11 Aug 2004 3:36 PM
Updated: Fr, 10 Sep 2004 10:52 AM
Environment: AndroMDA 3M2, Win2k
Description:
The ejb cartridge generates the <BeanName>Bean class for each entity of the model
(apart from other files ;)). Inside this class the method "ejbCreateImpl()" is
created. Inside this method the CMP fields will be set. The problem is that the method
tries to access the fields and does not use the accessor methods. This causes a
compile error, because the field is not present in this class but will be set in the
subclass generated by the EJB Container.
In my example I created a class called "HelloWorldData" with the stereotype
<<Entity>>. I added an attribute called "id" which is of the type "String" and added
the stereotype <<PrimaryKey>> to it. The additional attribute "text" (also a String)
is a normal field that should be persisted.
The transformations creates for this model the following code inside the
HelloWorldDataBean class:
protected void ejbCreateImpl() throws javax.ejb.CreateException{
if (id == null) {
id = new java.rmi.server.UID().toString();
}
}
---- complete listing of class -----
/* Autogenerated by AndroMDA (EntityBean.vsl) - do not edit */
package de.novatec.crm;
/**
* Autogenerated EJB implementation class for HelloWorldData
*
*
*
* @ejb.bean generate="true"
* name="HelloWorldData"
* type="CMP"
* cmp-version="2.x"
* view-type="local"
* local-jndi-name = "ejb/de.novatec.crm.HelloWorldData/Local"
* primkey-field = "id"
*
* @ejb.interface generate="false" local-class="de.novatec.crm.HelloWorldData"
* @ejb.home generate="false" local-class="de.novatec.crm.HelloWorldDataLocalHome"
* @ejb.pk generate = "false" class = "java.lang.String"
*
* @ejb.persistence table-name="HELLO_WORLD_DATA"
*
*
* @ejb.finder signature="java.util.Collection findByName(java.lang.String name)"
* query="SELECT DISTINCT OBJECT(c) FROM HelloWorldData as c WHERE c.name =
?1"
*
* @ejb.finder signature="java.util.Collection findAll()"
* query="SELECT DISTINCT OBJECT(c) FROM HelloWorldData as c"
*/
public abstract class HelloWorldDataBean
implements javax.ejb.EntityBean
{
// ----------- constant definitions -----------
// -- accessors for environment entries --
// -- accessors for constants --
// --------------- attributes ---------------------
/**
* Get the id property
*
*
* @ejb.pk-field
* @ejb.persistence
* column-name="ID"
* jdbc-type="java.lang.String"
* sql-type="java.lang.String"
*
*/
public abstract java.lang.String getId();
/**
* Set the id property
* @param value the new value
*/
public abstract void setId(java.lang.String value);
/**
* Get the text property
*
*
* @ejb.persistence
* column-name="TEXT"
* jdbc-type="java.lang.String"
* sql-type="java.lang.String"
*
*/
public abstract java.lang.String getText();
/**
* Set the text property
* @param value the new value
*/
public abstract void setText(java.lang.String value);
// ------------- CMR relations ------------------
// ---------------- business and select methods ----------------------
/**
*
*
* @ejb.interface-method
*/
public abstract java.util.Collection findByName(java.lang.String name);
/**
*
*
* @ejb.interface-method
*/
public abstract java.util.Collection findAll();
// ---------------- create methods --------------------
/**
* Implementation for the create method with all CMP attributes.
* This method calls the super class implementation for inherited
* CMP fields and sets all CMP fields defined in this class to the
* values provided by the parameters. Override this method in the
* implementation class if you need different behaviour.
*
* This extra implementation method is necessary to avoid
* problems with different primary key classes.
*
*/
protected void ejbCreateImpl()
throws javax.ejb.CreateException
{
if (id == null)
{
id = new java.rmi.server.UID().toString();
}
}
/**
* Create method with all CMP attribute values.
* @ejb.create-method
* @ejb.transaction type="Required"
* @return <code>null</code> as required by the EJB specification for CMP
* (chapter 10.5.2, "Bean Provider's entity bean instance's view")
*/
public java.lang.String ejbCreate()
throws javax.ejb.CreateException
{
ejbCreateImpl();
return null;
}
public void ejbPostCreate()
throws javax.ejb.CreateException
{
}
// ---------------- accessor methods for bean references ---------------
}
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://team.andromda.org:8080/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel