Okay, I have taken the advice of many people on this list.  (Thanks to all who replied, by the way!)   And, I've wound up with this:
 

/**

* @ejb.bean name="Employee"

* jndi-name="EmployeeBean"

* type="CMP"

* primkey-field="employeeID"

* schema="MyEmployee"

* cmp-version="2.x"

*

* @ejb.persistence

* table-name="employee"

*

* @ejb.finder

* query="SELECT OBJECT(a) FROM MyEmployee as a"

* signature="java.util.Collection findAll()"

*

**/

public abstract class EmployeeBean implements EntityBean {

 <more stuff here>

/**

* @ejb.interface-method

*

* @ejb.relation

* name = "employee-address"

* role-name = "employeeHasAddress"

* cascade-delete = "yes"

* target-ejb = "Address"

* target-role-name = "AddressBelongsToEmployee"

*

* @jboss.relation

* fk-constraint = "true"

* related-pk-field = "addressID"

* fk-column = "addressID"

*

* @author SDNakhla

*

*/

public abstract Address getAddress();

/**

* @ejb.interface-method

*/

public abstract void setAddress(Address address);

}

However, if I try and call setAddress() I get a rather large list of exceptions.  The records are created in my database in both the employee and address tables, except that the addressID (the foreign key corresponding to the primary key of my address) in the employee table is set to null.  Below is the stack trace I'm receiving when the exception occurs.  Just for more information, I'm using JBoss 3.2.2 and MySQL on the backend.  Can anyone explain what is happening?  I've been trying for about 2 weeks, now, and this is the exact same error I keep getting, regardless of the method (XDoclet, manually creating classes, etc.) that I choose.  Thanks in advance!
 

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

java.rmi.ServerException: EJBException:; nested exception is:

javax.ejb.EJBException: null; CausedByException is:

null

at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)

at sun.rmi.transport.Transport$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Unknown Source)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)

at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)

at sun.rmi.server.UnicastRef.invoke(Unknown Source)

at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)

at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)

at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)

at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)

at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)

at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:97)

at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)

at $Proxy3.setAddress(Unknown Source)

at ejb.addressbook.AddressBookClient.testBean(AddressBookClient.java:76)

at ejb.addressbook.AddressBookClient.main(AddressBookClient.java:90)

Caused by: java.rmi.ServerException: EJBException:; nested exception is:

javax.ejb.EJBException: null; CausedByException is:

null

at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:347)

at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)

at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)

at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:490)

at org.jboss.ejb.Container.invoke(Container.java:700)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)

at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)

at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)

at sun.rmi.transport.Transport$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Unknown Source)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: javax.ejb.EJBException: null; CausedByException is:

null

at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:745)

at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDBCCMRFieldBridge.java:590)

at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:121)

at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)

at ejb.addressbook.EmployeeCMP$Proxy.setAddress(<generated>)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1095)

at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:71)

at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:277)

at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)

at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:114)

at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:163)

at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)

at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:54)

at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)

at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)

at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)

at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)

at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)

... 21 more



guo yingshou <[EMAIL PROTECTED]> wrote:
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 {
>
>
>
> }
>
>
>
> 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 {
>
>
>
> }
>
> 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


Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

Reply via email to