You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by sj...@stradefi.com on 2006/07/12 14:54:47 UTC

UserTransaction

Hi!

I got into troubles and got some error messages such as:

A system error happened during the operation: The transaction has already
been marked for rollback

I guess I have these problems because I did not really understand correctly
when to use or not these UserTransaction. I need to use them when I want to
read or modifiy my database mySQL? 
If I have a method calling another method which one should use
UserTransaction, both?

UserTransaction tx = null;
try{
	tx = Repository.getUserTransaction(context, true);
	tx.begin();
	...method() -> using UserTransaction?
	tx.commit();
}
catch(Exception e){
	// rollback the transaction
	try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
	logger.error("Exception method " + e.getMessage());
}

Could someone explain me how that is working exactly?
Thanks in advance
Sophie