Bugs item #523239, was opened at 2002-02-27 02:24 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=376685&aid=523239&group_id=22866
Category: JBossCMP Group: v3.0 Rabbit Hole Status: Closed Resolution: Fixed Priority: 5 Submitted By: Marcel Ammerlaan (mam) Assigned to: Dain Sundstrom (dsundstrom) Summary: jbosscmp-jdbc.xml problem Initial Comment: When the <ejb-relationship-role> tag is included in jbosscmp-jdbc.xml an exception is thrown when a bean is added to a relation. The exception is: 03:18:41,539 ERROR [GlobalTxEntityMap] Store failed on entity: 1 javax.ejb.EJBException: Could insert relations into ABean_b_BBean_a Embedded Exception null at org.jboss.ejb.plugins.cmp.jdbc.JDBCInsertRelationsCommand.execute(JDBCInsertRelationsCommand.java:78) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.insertRelations(JDBCStoreManager.java:481) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.synchronizeRelationData(JDBCStoreManager.java:443) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:424) at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:428) at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:677) at org.jboss.ejb.GlobalTxEntityMap.syncEntities(GlobalTxEntityMap.java:89) at org.jboss.ejb.GlobalTxEntityMap$GlobalTxEntityMapCleanup.beforeCompletion(GlobalTxEntityMap.java:158) at org.jboss.tm.TxCapsule.doBeforeCompletion(TxCapsule.java:1317) at org.jboss.tm.TxCapsule.commit(TxCapsule.java:325) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:190) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166) at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:308) at org.jboss.ejb.Container.invoke(Container.java:668) at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555) at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523) at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:364) at java.lang.reflect.Method.invoke(Native Method) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241) at sun.rmi.transport.Transport$1.run(Transport.java:152) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:148) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706) at java.lang.Thread.run(Thread.java:484) java.lang.NullPointerException at org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.getJDBCTypes(SQLUtil.java:422) at org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.getColumnNamesClause(SQLUtil.java:94) at org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.getColumnNamesClause(SQLUtil.java:85) at org.jboss.ejb.plugins.cmp.jdbc.JDBCInsertRelationsCommand.getSQL(JDBCInsertRelationsCommand.java:95) at org.jboss.ejb.plugins.cmp.jdbc.JDBCInsertRelationsCommand.execute(JDBCInsertRelationsCommand.java:60) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.insertRelations(JDBCStoreManager.java:481) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.synchronizeRelationData(JDBCStoreManager.java:443) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:424) at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:428) at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:677) at org.jboss.ejb.GlobalTxEntityMap.syncEntities(GlobalTxEntityMap.java:89) at org.jboss.ejb.GlobalTxEntityMap$GlobalTxEntityMapCleanup.beforeCompletion(GlobalTxEntityMap.java:158) at org.jboss.tm.TxCapsule.doBeforeCompletion(TxCapsule.java:1317) at org.jboss.tm.TxCapsule.commit(TxCapsule.java:325) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:190) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166) at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:308) at org.jboss.ejb.Container.invoke(Container.java:668) at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555) at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523) at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:364) at java.lang.reflect.Method.invoke(Native Method) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241) at sun.rmi.transport.Transport$1.run(Transport.java:152) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:148) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706) at java.lang.Thread.run(Thread.java:484) 03:18:41,565 INFO [STDOUT] 1:ROLLBACK I've attached a testcase that can be deployed in Jboss and run as a client using: java -jar beans-ejb.jar nl.paardenmarkt.ejb.Test. The testcase as attached works, but when the lower-halve of jbosscmp-jdbc is included (by removing the comments) it will not run. This code is generated with XDoclet, so it might be a problem with their template. This is on RH3.0 CVS 26 feb. 2002 ---------------------------------------------------------------------- >Comment By: David Jencks (d_jencks) Date: 2002-03-05 05:48 Message: Logged In: YES user_id=60525 I couldn't get any parts of my example ( test bean cmp2/cmr/ejb/CMRBugBean) to work with explicit key-fields, nor could I come up with something xdoclet would generate that jbosscmp would accept. So, I added a condition to the xdoclet template: if you put @jboss:auto-key-fields in the cmr accessor, xdoclet will leave out the key-fields element entirely, and jbosscmp will happily auto-generate something that works. This is in xdoclet cvs, and should be in 1.1.2 due any day now. David Jencks ---------------------------------------------------------------------- Comment By: Dain Sundstrom (dsundstrom) Date: 2002-03-03 22:27 Message: Logged In: YES user_id=251431 I added code to throw a Deployment exception if neither side of a foreign-key mapped relationship has keys or if either side of a relation-table mapped relationship doesn't have keys. ---------------------------------------------------------------------- Comment By: Dain Sundstrom (dsundstrom) Date: 2002-03-03 21:50 Message: Logged In: YES user_id=251431 In your jbosscmp-jdbc.xml file you have the following: <relationships> <ejb-relation> <ejb-relation-name>ABeanB</ejb-relation-name> <foreign-key-mapping/> <!-- <ejb-relationship-role> <ejb-relationship-role-name>A-has-B</ejb- relationship-role-name> <key-fields/> </ejb-relationship-role> <ejb-relationship-role> <ejb-relationship-role-name>B-belongs_to-A</ejb- relationship-role-name> <key-fields/> </ejb-relationship-role> --> </ejb-relation> </relationships> Notice that both "key-fields" elements are empty. By doing this you are telling the store manager that neither side of the relationship will have foreign keys. I will try to add some code to throw a deployment exception in this case. In the mean time, add some keys to atleast one side of the relationship. ---------------------------------------------------------------------- Comment By: David Jencks (d_jencks) Date: 2002-03-02 01:05 Message: Logged In: YES user_id=60525 I've just committed a test case that happens to demonstrate this problem. org.jboss.test.cmp2.cmr.test.CMRPostCreatesWrittenUnitTestCase This test uses xdoclet also, and works fine if you remove the relationships element from the generated jbosscmp-jdbc.xml, but fails when it is present. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=376685&aid=523239&group_id=22866 _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development