Craig, Perhaps this is a bit off topic, but I am curious if you know of a way to force JBoss to set 'deferral' of a constraint for a particular transaction? The reason is I would like to avoid building a constraint that is "DEFERRABLE, INITIALLY DEFERRED" if I possibly can. Since I'm using CMP, I have no way (that I know of) to set the constraint to be deferred.
Thanks -----Original Message----- From: Craig Hamilton [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 11:37 AM To: [EMAIL PROTECTED] Subject: RE: [Xdoclet-user] ejbCreate<METHOD>() and ejbPostCreate<METHOD>() code contents Troy, This really isn't an issue with JBoss, it is with Oracle. The J2EE spec says that relationships are set in the postCreate method. JBoss sets the primary key attributes with an insert in the ejbCreate, and then the fk fields with an update in postCreate. The problem is that the constraints are being checked immediately, not at commit time. Fortunately there is a fix which works for Oracle. There is a concept of deferrable constraints. You should make foreign keys initially deferred. If you have non-null fields, you will also have to set them up the same. craig --__--__-- Message: 12 From: "Poppe, Troy" <[EMAIL PROTECTED]> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> Date: Wed, 9 Jul 2003 10:28:30 -0400 Subject: [Xdoclet-user] ejbCreate<METHOD>() and ejbPostCreate<METHOD>() code contents Reply-To: [EMAIL PROTECTED] I currently have a number of CMP beans that have bi-directional CMRs. I am using the value object pattern as implemented by XDoclet. I am running my EJBs on JBoss 3.2.1 against Oracle 8i. In coding my ejbCreate<METHOD>() and ejbPostCreate<METHOD>() methods, I have come across something that I am curious how others have solved this (since it deals at least partly with XDoclet's implementation of VOs). It is my understanding that in the ejbCreate method you are supposed to get a primary key, set it and return null. In my ejbPostCreate method, I set the contents of the value object. However, when I do this (in JBoss), I get complaints (in ejbCreate) from Oracle about my foreign key: javax.ejb.CreateException: Could not create entity:java.sql.SQLException: ORA-01400: cannot insert NULL into ("HR"."ASSIGNEDPOSITIONSTATE"."ASSIGNEDPOSITIONID") Now, the contents of my foreign key relationships are in the value object, and will be set in ejbPostCreate. So there are a couple questions. 1. Should I be setting the values of my NOT NULL fields in ejbCreate()? 2. Is there some way that I can force JBoss 3.2.1 to hold it's horses, and set the rest of the values in ejbPostCreate()? Thanks in advance. Troy ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
