Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

1-many Relationship with XDoclet
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=E
JB 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);



Report this thread to moderator Post Follow-up to this message
Old Post
Simon Lammerding
03-20-04 01:46 AM


Re: 1-many Relationship with XDoclet
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


"Simon Lammerding" <spam@muelltonne.de> schrieb im Newsbeitrag
news:c2nrhs$vi7$1@sagnix.uni-muenster.de...
> 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=E
JB 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);
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Michael Meyer
03-20-04 01:46 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Beans archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 01:13 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.