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

Reply via email to