dcsimg
creating a 1:1 unidirectional relationship
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Paul_Erion
Posted On:   Thursday, September 12, 2002 11:56 AM

I seem to be having a bit of a problem figuring out how to use XDoclet to declare a 1:1 unidirectional relationship and was wondering if someone could help. Say, for example, I'm mapping a building to an address. In the Building bean I would have (as a start) the following method declaration: /** * @ejb:persistent-field * @ejb:relation name="Building-Address" * role-name="Building-has-Address" * target-ejb="Address" * @ejb:interface-method view-type="local" */ public abstract AddressLocal getAddress(); but I think I also need to use the "target-role"   More>>

I seem to be having a bit of a problem figuring out how to use XDoclet to declare a 1:1 unidirectional relationship and was wondering if someone could help.


Say, for example, I'm mapping a building to an address. In the Building bean I would have (as a start) the following method declaration:


			
/**
* @ejb:persistent-field
* @ejb:relation name="Building-Address"
* role-name="Building-has-Address"
* target-ejb="Address"
* @ejb:interface-method view-type="local"
*/
public abstract AddressLocal getAddress();


but I think I also need to use the "target-role" attribute, and I'm also not quite sure what tags I need (if any) and where to put them in the Address bean.


Any help, or pointers to examples would be greatly appreciated ... oh, I looked through the sample code on the XDoclet site, but didn't see anything that would be of help (if an example *does* exist there, and I overlooked it a pointer would be great).


Thanks,


:Paul

   <<Less

Re: creating a 1:1 unidirectional relationship

Posted By:   Paul_Erion  
Posted On:   Thursday, September 12, 2002 01:31 PM

hmmm, I think I should also mention that I'm using JBoss. The error that I'm getting from JBoss contains the phrase: "No ejb-relationship-role-name element found". The relevant portion of "ejb-jar.xml" looks ok (not that I'm an expert, or even have much of a clue)




Building-Address


Building-has-Address
One

Building


address



One

Address





but in the "jbosscmp-jdbc.xml" file there is definitely no "ejb-relationship-role-name"



Building-Address


Building-has-Address









Sigh, too be honest I'm not sure what part of this is broken ... but it's probably me.


Any help would be greatly appreciated.


Paul

About | Sitemap | Contact