-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I seem to have resolved it. I had a foreign key specified in both the user_info and user_login descriptors and the user_login descriptor busted the insert. Removing the foreign key worked, I'm going to use an inverse foreign key.
R
Robert S. Sfeir wrote: | Folks, | | I'm trying to do an double insert in 2 tables and for some reason I'm | getting a NullPointerException. The way I go about it is below: | | //Open transaction | tx = getOdmgImpl().newTransaction(); | | //Transaction begins | tx.begin(); | //Do first Insert | tx.lock( user, Transaction.WRITE ); | //Get User ID after insert and set it in the second Bean | userLoginBean.setUserID( user.getUserID() ); | //Do second insert | tx.lock( userLoginBean, Transaction.WRITE ); | //commit | tx.commit(); | | The problem, from my debugging investigation, is that OJB seems to think | that userID is empty, it's not, because as I was stepping through the | debugger, I could see that userLoginBean.getUserID() returned a correct | value, the one from the first insert. | | I do have a catch clause so that if an exception is thrown it will do | tx.abort() but it seems that if I don't catch some exception, like one I | haven't accounted for yet, and an exception gets thrown, then the first | insert is commited anyway... Is this correct behavior? | | Is this the right way of doing a double table insert? | | Thanks | R
- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE/tYRf+cV9vuB27SARAtZxAJ9kQrsU+2J6P8VX3CXGLz5fbK9d/gCdGxDG NyDbLlFLGMkap+Kt8+HQf6Q= =5QJo -----END PGP SIGNATURE-----
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
