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