-
1. Re: A CMR collection may only be used within the transction
h2o_polo Jan 3, 2003 12:19 PM (in response to icordoba)to wrap your code into UserTransaction your will need to the following:
javax.transasction.UserTransaction ut = null;
boolean bFailed = false;
try {
Context initCtx = new InitialContext();
ut = (UserTransaction) initCtx.lookup("UserTransaction");
ut.begin ();
// ... do your stuff here ...
} catch (Exception e) {
bFailed = true;
// ... do your exception handling
} finally {
// commit or rollback your transaction
if (bFailed) {
try { ut.rollback (); } catch (Exception e0) {}
} else {
try { ut.commit (); } catch (Exception e0) {}
}
}
Alex. -
2. Re: A CMR collection may only be used within the transction
h2o_polo Jan 3, 2003 12:21 PM (in response to icordoba)to wrap your code into UserTransaction your will need to the following:
javax.transasction.UserTransaction ut = null;
boolean bFailed = false;
try {
Context initCtx = new InitialContext();
ut = (UserTransaction) initCtx.lookup("UserTransaction");
ut.begin ();
// ... do your stuff here ...
} catch (Exception e) {
bFailed = true;
// ... do your exception handling
} finally {
// commit or rollback your transaction
if (bFailed) {
try { ut.rollback (); } catch (Exception e0) {}
} else {
try { ut.commit (); } catch (Exception e0) {}
}
}
Alex. -
3. Re: A CMR collection may only be used within the transction
icordoba Jan 4, 2003 12:25 PM (in response to icordoba)Thanks a lot for your reply.
I had tried that in other app, but my real problem here is that I am using the JBoss generated Collection in a JSP page, with the JSTL forEach tag... I try not to write java code in my jsp pages.
Is there a transaction tag or a way to wrap JSP tags into a transaction?
Thanks again. -
4. Re: A CMR collection may only be used within the transction
peterhawkins Feb 25, 2004 7:26 PM (in response to icordoba)"I try not to write java code in my jsp pages"? Bahaha! Tags are for fags.
:0