Well the simplest way is to use middlegen. It is very very easy. Just follow the example sample to get an idea but basically it well look at your database and generate the entity beans for you (including all the xdoclet tags). Tim
-----Original Message----- From: Steven Nakhla [mailto:[EMAIL PROTECTED] Sent: Thu 06/11/2003 23:30 To: [EMAIL PROTECTED] Cc: Subject: [Xdoclet-user] XDoclet and EJB with CMR -- Newbie 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 The information in this email is confidential and is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, except for the purpose of delivery to the addressee, is prohibited and may be unlawful. Kindly notify the sender and delete the message and any attachment from your computer. ------------------------------------------------------- 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
