> -----Original Message----- > From: Chandra kumar [mailto:[EMAIL PROTECTED]] > > > Back to my question again, Let's say we set the relationship > value in ejbPostCreate() as specified in the spec. What if > the relationship(forignkey) field is set as not null in child > table and DB insert happening after ejbCreate(), insert will > fail. I think I'm missing something here, because I still > don't seem to understand significance of the statement in the > spec that says "do not set the cmr-fields in ejbCreate()" > > I humbly seek help on this to understand better. >
Well, Let's say you have these two tables: TBL_FOO === FOO_ID (PK) FOO_VAL TBL_BAR ======= BAR_ID (PK) FOO_ID (FK) BAR_VAL Now, in your ejbCreate(barId, fooId, barVal) you can just set the fooId property. This isn't actually referencing the CMR relationship, but will fulfill the NOT NULL requirement. You could also, if necessary, pass all of the values for FOO to the ejbCreate() of bar and have it use the Home interface of FOO to create a foo and get its PK to call a setFooId(fooID), which does the same thing. Maybe this is cheating, but it's worked for me. Jason ==========================================================================To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
