If you remove or disable the integrity constraint does it insert both rows? Also can you change the mode of the integrity constraint to be deferred to commit time? I can't remember the command, but it would be interesting to see if that works any differently. Cheers Jay Walters -----Original Message----- From: Jason Dillon [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 30, 2000 9:55 PM To: [EMAIL PROTECTED] Subject: [jBoss-User] Entities, Transactions & Commits (Oh my... HELP!) Hello, I have been banging my head for three days now trying to deploy our application (which runs just fine under WebLogic 5.1) in jBoss v2.0. It seems that most of my problems are database related. My entities don't get persisted properly. In the basic scenario I have three beans (lets call them A, B & C) A is a stateless session bean, which creates B B is an entity bean C is an entity bean created after A (in the same TX), and has a foriegn key constraint to B.id (which is a java.lang.Long). I originally was using the 'org.jboss.minerva.xa.XADataSourceImpl' data source, which worked well for reading data, but failed to properly write data. With this configuration an oracle exception is throw: javax.ejb.CreateException: Could not create entity:java.sql.SQLException: ORA-02291: integrity constraint (PLEXUS.FK_B_ID) violated - parent key not found This looks like there was never an insert into the B table and thus the FK constraint on C.b_id fails. Interesting though If I change the transaction isolation on A.createBandC to 'Supports', the same thing happends, which looks like nothing is every being commited. I also had a sql prompt opened, so I could check if any records were inserted and found nothing (with the server running and after killing it). I tried changing the data-source to 'oracle.jdbc.xa.client.OracleXADataSource', but with this configuration I get: java.sql.SQLException: ORA-00060: deadlock detected while waiting for resource In my sql prompt, rows would not actually show up until I ctrl-c'd the server. Both entities use the 'Standard CMP EntityBean' configuration, which has been modified in 'conf/default/standardjboss.xml': Optimized: False Commit-option: C (which is a shared db I believe) The session is a 'Standard Stateless SessionBean' and that configuration has not been modified. The assembly descriptor for A & B looks like this: ----8<---- <assembly-descriptor> <!-- Methods with 'Supports' TIO --> <container-transaction> <method> <ejb-name>A</ejb-name> <method-name>*</method-name> </method> <method> <ejb-name>B</ejb-name> <method-name>*</method-name> </method> <trans-attribute>Supports</trans-attribute> </container-transaction> <!-- Methods with 'Required' TIO --> <container-transaction> <method> <ejb-name>A</ejb-name> <method-name>createBandC</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> ---->8---- So the call to A.createBandC(), should have a transaction created if there isn't already one. In my case there isn't. When I run the 'same' code under WebLogic (with the jndi context changed via a system property) every thing runs fine. Does anyone have any clues as to why jBoss would behave like this? --jason -- -------------------------------------------------------------- To subscribe: [EMAIL PROTECTED] To unsubscribe: [EMAIL PROTECTED] Problems?: [EMAIL PROTECTED] -- -------------------------------------------------------------- To subscribe: [EMAIL PROTECTED] To unsubscribe: [EMAIL PROTECTED] Problems?: [EMAIL PROTECTED]
