Do like this:
/**
* @ejb.relation
* name="empleyee-address"
* role-name="employeeHasAddress"
* cascade-delete="yes"
* target-ejb="EmployeeAddress"
* target-role-name="addrBelongEmp"
* @jboss.relation
* fk-constraint="true"
* related-pk-field="employeeID"
* fk-column="eid"
*/
public abstract EmployeeAddress getAddress();
If not work, let me know.
guo
--- Steven Nakhla <[EMAIL PROTECTED]> 的正文:> I'm
new to EJB development, particularly using
> XDoclet. What I would like is to implement a simple
> demo application, an employee address book. I'm
> using JBoss 3.2.2 with Eclipse 2.1.1 as my IDE.
> Also, I used the Lomboz plugin to do the initial
> bean development. I have the latest XDoclet
> installed, as well.
>
> My first bean, EmployeeInfoBean, is declared as
> follows:
>
>
> /**
>
> * @ejb.bean name="EmployeeInfo"
>
> * jndi-name="EmployeeInfoBean"
>
> * type="CMP"
>
> * primkey-field="employeeID"
>
> * schema="MyEmployeeInfo"
>
> * cmp-version="2.x"
>
> *
>
> * @ejb.persistence
>
> * table-name="employee"
>
> *
>
> * @ejb.finder
>
> * query="SELECT OBJECT(a) FROM MyEmployeeInfo as a"
>
> * signature="java.util.Collection findAll()"
>
> *
>
> **/
>
> public abstract class EmployeeInfoBean implements
> EntityBean {
>
> <misc stuff here>
>
> }
>
>
>
> I have a second bean, EmployeeAddressBean, declared
> in a similar manner:
>
> /**
>
> * @ejb.bean name="EmployeeAddress"
>
> * jndi-name="EmployeeAddressBean"
>
> * type="CMP"
>
> * primkey-field="addressID"
>
> * schema="MyEmployeeAddress"
>
> * cmp-version="2.x"
>
> *
>
> * @ejb.persistence
>
> * table-name="address"
>
> *
>
> * @ejb.finder
>
> * query="SELECT OBJECT(a) FROM MyEmployeeAddress as
> a"
>
> * signature="java.util.Collection findAll()"
>
> *
>
> **/
>
> public abstract class EmployeeAddressBean implements
> EntityBean {
>
> <more misc stuff>
>
> }
>
> When I run XDoclet, it creates the expected
> interfaces and util classes. What I would like to
> do, however, is declare methods in my Employee Info
> class to associate an address with an employee.
> Something like this:
>
> public void setAddress(EmployeeAddress address);
>
> public EmployeeAddress getAddress();
>
> I would like to use CMR to accomplish this. I want
> it to be a one-one unidirectional relationship. The
> question is, how can I do this with XDoclet? Can
> someone please explain to me what tags I need to
> have in my code to accomplish this? I've tried a
> couple of times, but I end up with null exceptions,
> and there is no association created in my database.
>
> Can anyone help me out with this? Thanks in
> advance!
>
>
>
> Steve Nakhla
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user