For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 6 replies, 3 voices, and was last updated 21 years, 5 months ago by
Greg.
-
AuthorPosts
-
dbsoftMemberHello,
I’ve got problem with deployment descriptor generation.
Env: Win2k, Eclipse 3.1.0, MyEclipse 3.8.1, JBoss 3.2.5There are 4 relationships in CustomerEJB:
* @ejb.relation name = “Customer-HomeAddress”
* @ejb.relation name = “Customer-Phones”
* @ejb.relation name = “Customer-CreditCard”
* @ejb.relation name = “Customer-BillingAddress”The XDoclet generates an incorrect <ejb-relation> for the 1st (“Customer-HomeAddress”) relationship.
What is wrong with that 1st XDoclet definition ?~ ~ ~
/**
*
*@ejb.bean name = “CustomerEJB”
* display-name = “Customer Entity”
* description = “Customer Entity Bean”
* cmp-version = “2.x”
* type = “CMP”
* view-type = “local”
* local-jndi-name = “CustomerHomeLocal”
* schema = “Customer”
* primkey-field = “id”
* transaction-type = “Container”
* @ejb.interface local-class = “com.titan.interfaces.CustomerLocal”
* @ejb.home local-class = “com.titan.interfaces.CustomerHomeLocal”
* @ejb.finder signature = “com.titan.interfaces.CustomerLocal findByPrimaryKey(java.lang.Integer id)”
* query = “SELECT Object(cust) FROM Customer cust WHERE cust.id = ?1”
* view-type = “local”
* @ejb.pk class = “java.lang.Integer”
* @ejb.persistence table-name = “customerejb”
* @ejb.util generate = “physical”
*
* @jboss.persistence datasource = “java:/jdbc/MySqlDSj2ee”
* datasource-mapping = “mySQL”
* table-name = “customerejb”
*/
public abstract class CustomerBean implements javax.ejb.EntityBean~ ~ ~
///////////////////////////
// persistent relationships
////////////////////////////**
* @return
*
* @ejb.relation name = “Customer-HomeAddress”
* role-name = “Customer-has-a-Address”
* target-role-name = “Address-belongs-to-Customer”
* target-ejb = “AddressEJB”
* @ejb.interface-method
**/
public abstract com.titan.interfaces.AddressLocal getHomeAddress();
/**
* @ejb.interface-method
**/
public abstract void setHomeAddress(com.titan.interfaces.AddressLocal address);/**
* @return
*
* @ejb.relation name = “Customer-Phones”
* role-name = “Customer-has-many-Phones”
* target-role-name = “Phone-belongs-to-Customer”
* target-multiple = “no”
* target-ejb = “PhoneEJB”
* @ejb.interface-method
*
**/
public abstract java.util.Collection getPhoneNumbers( );
/**
* @ejb.interface-method
**/
public abstract void setPhoneNumbers(java.util.Collection phones);/**
* @return
*
* @ejb.relation name = “Customer-CreditCard”
* role-name = “Customer-has-a-CreditCard”
* target-role-name = “CreditCard-belongs-to-Customer”
* target-ejb = “CreditCardEJB”
* @ejb.interface-method
**/
public abstract com.titan.interfaces.CreditCardLocal getCreditCard();
/**
* @ejb.interface-method
**/
public abstract void setCreditCard(com.titan.interfaces.CreditCardLocal card);/**
* @return
*
* @ejb.relation name = “Customer-BillingAddress”
* role-name = “Customer-has-a-BillingAddress”
* target-role-name = “BillingAddress-belongs-to-Customer”
* target-ejb = “AddressEJB”
* @ejb.interface-method
**/
public abstract com.titan.interfaces.AddressLocal getBillingAddress();
/**
* @ejb.interface-method
**/
public abstract void setBillingAddress(com.titan.interfaces.AddressLocal billingAddress);~ ~ ~
Thanks in advance
Mihaly
September 29, 2004 at 11:01 am #216399
Riyad KallaMemberMihaly,
Just an FYI, we don’t support users running Eclipse 3.1 and encourage you to downgrade to 3.0.1 for the best experience.I will ask our XDoclet guy however to see if he knows whats going on.
September 29, 2004 at 12:09 pm #216408
GregMemberNothing looks wrong with your EJB source file that I can tell. You could try upgrading the xdoclet modules to version 1.2.1.
– Download the xdoclet-lib-1.2.1.zip file from http://prdownloads.sourceforge.net/xdoclet/xdoclet-lib-1.2.1.zip?download
– Go to dir <MyEclipse_install>/eclipse/plugins/com.genuitec.jboss.ide.eclipse.xdoclet.core_<version>/
– Make a copy of entire plugin contents and keep in a backup folder
– unzip contents of xdoclet-lib into this directories overwriting existing files.
– Bring up MyEclipse go to Window->Preferences->MyEclipse->XDoclet and click “Refresh XDoclet Modules”
– Go to Window->Preferences->MyEclipse->XDoclet->Code Assist and click “Refresh XDoclet data”Then try to regenerate your ejb files. If something doesn’t work you can just restore plugin files with backup copy and refresh xdoclet data again.
September 29, 2004 at 2:26 pm #216420
dbsoftMemberGreg,
I deleted [*1.2.jar] files from [E:\eclipse3\myeclipse\eclipse\plugins\com.genuitec.jboss.ide.eclipse.xdoclet.core_3.8.1 ] directory
and extracted [xdoclet-lib-1.2.1.zip] file into that directory, then refreshed “XDoclet Modules”.
Regenerating EJB moduls, I’ve got the same result as with XDoclet v.1.2.~ ~ ~
<!– Relationships –>
<relationships >
<ejb-relation >
<ejb-relation-name>Customer-HomeAddress</ejb-relation-name><ejb-relationship-role >
<ejb-relationship-role-name>Customer-has-a-Address</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>homeAddress</cmr-field-name>
</cmr-field>
</ejb-relationship-role><ejb-relationship-role >
<ejb-relationship-role-name>CreditCard-belongs-to-Customer</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>CreditCardEJB</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>customer</cmr-field-name>
</cmr-field>
</ejb-relationship-role></ejb-relation>
<ejb-relation >
<ejb-relation-name>Customer-BillingAddress</ejb-relation-name><ejb-relationship-role >
<ejb-relationship-role-name>Customer-has-a-BillingAddress</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>billingAddress</cmr-field-name>
</cmr-field>
</ejb-relationship-role><ejb-relationship-role >
<ejb-relationship-role-name>BillingAddress-belongs-to-Customer</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>AddressEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role></ejb-relation>
<ejb-relation >
<ejb-relation-name>Customer-Phones</ejb-relation-name><ejb-relationship-role >
<ejb-relationship-role-name>Customer-has-many-Phones</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>phoneNumbers</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role><ejb-relationship-role >
<ejb-relationship-role-name>Phone-belongs-to-Customer</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>PhoneEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role></ejb-relation>
<ejb-relation >
<ejb-relation-name>Customer-CreditCard</ejb-relation-name><ejb-relationship-role >
<ejb-relationship-role-name>Customer-has-a-CreditCard</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>creditCard</cmr-field-name>
</cmr-field>
</ejb-relationship-role><ejb-relationship-role >
<ejb-relationship-role-name>CreditCard-belongs-to-Customer</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>CreditCardEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role></ejb-relation>
<!–
To add relationships for beans not managed by XDoclet, add
a file to your XDoclet merge directory called relationships.xml that contains
the <ejb-relation></ejb-relation> markups for those beans.
–>
</relationships><!– Assembly Descriptor –>
Thank you for your effort
Mihaly
September 30, 2004 at 1:48 am #216482
GregMemberSome other questions…
1. Are you sure that the first role is unidirectional? Because if you use the target-role-name, the relation must be unidirectional. What about the other roles are they all unidirectional as well?
2. The relation name is Customer-HomeAddress, but the target EJB is AddressEJB, not HomeAddressEJB. This notation varies from the pattern in other beans. Is there a reason?These are just thoughts I throwing out there to see if we can collectively find the answer.
September 30, 2004 at 7:20 am #216492
dbsoftMemberGreg,
I’ve found the problem, it was my mistake. All relationships are unidirectional, except [Customer-CreditCard] relationship and
I’ve made a mistake in the [@ejb.relation] tag of the [CreditCard] Entity Bean:~ ~ ~
CustomerEJB —(1:1/U)—> “Customer-HomeAddress” <—+
CustomerEJB —(1:1/U)—> “Customer-Phones” |
CustomerEJB —(1:1/B)—> “Customer-CreditCard” ——+
CustomerEJB —(1:1/U)—> “Customer-BillingAddress”~ ~ ~
//////////////////////
// relationship fields
///////////////////////**
* @return
*
* @ejb.relation name = “Customer-HomeAddress” // <<<———– !!!
* role-name = “CreditCard-belongs-to-Customer”
* target-ejb = “CustomerEJB”
* target-multiple = “no”
* @ejb.interface-method
**/
public abstract com.titan.interfaces.CustomerLocal getCustomer( );
/**
* @ejb.interface-method
**/
public abstract void setCustomer(com.titan.interfaces.CustomerLocal cust);~ ~ ~
properly:
~ ~ ~
//////////////////////
// relationship fields
///////////////////////**
* @return
*
* @ejb.relation name = “Customer-CreditCard” // <<<———!!!
* role-name = “CreditCard-belongs-to-Customer”
* target-ejb = “CustomerEJB”
* target-multiple = “no”
* @ejb.interface-method
**/
public abstract com.titan.interfaces.CustomerLocal getCustomer( );
/**
* @ejb.interface-method
**/
public abstract void setCustomer(com.titan.interfaces.CustomerLocal cust);~ ~ ~
and it works.
Thanks
Mihaly
September 30, 2004 at 8:57 am #216501
GregMemberVery good, I’m glad you got it working.
-
AuthorPosts
