-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/tXRp+cV9vuB27SARAhy8AJ42hoS9ip23sLzhLmWbfE+8/obKSQCgrEpl
xzk9G4JUM27njZMwn3iVoUs=
=aiYd
-----END PGP SIGNATURE-----


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to