Hanson, Matthew wrote:
Hi,
I have modified the reentrancy tags for my beans to false, deployed the beans to binary download of Jboss 3.2.2 with insert-after-ejb-post-create, and now I catch the following exception in ejbCreate of the n-side bean:
2003-12-03 09:15:53,858 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract void homebrew.ejb.interfaces.accountHolderBeanLocal.setaccountHolderBeanValue(hom ebrew.ejb.interfaces.accountHolderBeanValue), causedBy: javax.ejb.CreateException: Primary key for created instance is null. at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManage r.java:520) at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManag er.java:208) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntit y(CachedConnectionInterceptor.java:269) at org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:580) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324)
Is the <entity-command name="hsqldb-fetch-key"> for the bean is being ignored in Jboss 3.2.2?
Please advise! Thanks!
Regards, Matt Hanson
-----Original Message----- From: Alexey Loubyansky [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 3:27 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] Container Responsibility for CMR Foreign Keys
By the spec, you may not establish relationships in ejbCreate but may in ejbPostCreate.
By default, INSERT is done after ejbCreate but before ejbPostCreate.
You can use insert-after-ejb-post-create to delay INSERT until after ejbPostCreate but this feature is available, AFAIR, since 3.2.2.
Hanson, Matthew wrote:
Hi,
I am using xdoclet 1.2b2 to generate deployment descriptors and classes, including value objects, for two beans that I hope to write with support
for
CMR. We also use Jboss 3.2.1 as my app server and hypersonic and/or mysql as the db.
Basically, I just want to write a relatively "ejb-standard" foreign keyed insert for 1:n-related beans that are both being creating together.
The bean class generated by xdoclet maintains vectors of added, removed,
and
updated value objects of the type that is the n-side of the 1:n
relationship
that I hope to support. It also generates a set...BeanValue() method to process the 1-side bean value object. This set...BeanValue() methods iterates across the n-side value objects and tries to create the n-siders via the create followed by Collection.add methods. The keys on the
1-side,
however, are not included in the value object, and the create fails the non-null foreign key constraint.
Before posting to xdoclet, I stepped back and started to think that the
ejb
container (Jboss) should probably creating and assigning foreign keys to
the
n-side with the local interface set methods. The ejb spec, however, does not seem to support this thought, and I do see posts on the jboss site
that
say the setting of foreign keys of the n-side is generally done in the ejbPostCreate method of the 1-side. Well, I tried that, and I can output the n-side value objects in the 1-side ejbPostCreate and see the updated
key
field, but the insert on the n-side still fails!?!?!?!?.
Now, I also see in the posts that Jboss 3.2.2 may offer a new tag <insert-after-ejb-post-create> in standardjboss.xml that prompts the app server to wait until after ejbPostCreate to try to write the n-side of the datasource.
Before I spend another day on this, I am wondering if someone can just
tell
me: (1) Are these keyed inserts on related beans even possible? (2) What is the recommended way to do them? (Code, new jboss version, other?)
Wow - I hope that I am making some sense, because it seems like a very common thing to do...
Any help would be great!
Regards, Matt Hanson
------------------------------------------------------- This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate. http://www.wrgsurveys.com/2003/osdntech03.php?site=8 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate. http://www.wrgsurveys.com/2003/osdntech03.php?site=8 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate. http://www.wrgsurveys.com/2003/osdntech03.php?site=8 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate. http://www.wrgsurveys.com/2003/osdntech03.php?site=8 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user