Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / March 2004

Tip: Looking for answers? Try searching our database.

1-many Relationship with XDoclet

Thread view: 
Simon Lammerding - 10 Mar 2004 19:50 GMT
Hello,

I have a problem with a 1-many Relationship, I have written with XDoclet for
JBoss 3.2.3.
There is always this JBoss-Error:

Depends On Me: org.jboss.deployment.DeploymentException: Role
'EntityBean1-EntityBean2' on Entity Bean 'EntityBean2' : CMP field for key
not found: field name='EntityBean1ID', ObjectName:
jboss.j2ee:jndiName=EntityBean2Local,service=EJB state: FAILED

My XDoclet-Tags are as follows:

Bean1:

/**
* @ejb.pk-field
* @ejb.persistence column-name = "Bean1ID"
*                            jdbc-type = "INTEGER"
*/
public abstract int getBean1ID();
public abstract void setBean1ID(int param);

/**
* @ejb.relation name = "Bean1-Bean2"
*                       role-name = "Many"
* @jboss.relation fk-column = "Bean1ID"
*                          related-pk-field = "Bean1ID"
*/
public abstract Bean2Local getBean2();
public abstract void setBean2(Bean2Local param);

Bean2:

/**
* @ejb.pk-field
* @ejb.persistence column-name = "IntProduktID"
*                             jdbc-type = "INTEGER"
*/
public abstract int getBean1ID();
public abstract void setBean1ID(int param);
/**
* @ejb.pk-field
* @ejb.persistence column-name = "IntBean2ID"
*                            jdbc-type = "INTEGER"
*/
public abstract int getBean2ID();
public abstract void setBean2ID(int param);

/**
* @ejb.relation name = "Bean1-Bean2"
* role-name = "One"
*/
public abstract Collection getBean1();
public abstract void setBean1(Collection param);
Michael Meyer - 11 Mar 2004 11:32 GMT
Hi,

I think first you have to add the target ejb

@ejb.relation
   target-ejb=. ...

relation-fk-column :  name of the column in the database
related-pk-field : name of the field in you ejb

And you have to give the target relation in bean 2

@jboss.target-relation
   related-pk-field
   fk-column

Hope it helps

Michael

> Hello,
>
[quoted text clipped - 51 lines]
> public abstract Collection getBean1();
> public abstract void setBean1(Collection param);


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.