[jboss-user] [JBoss Seam] - Re: flushMode= MANUAL, when does commit happen? And other qu
ellenzhao
do-not-reply at jboss.com
Sat Jul 14 07:19:16 EDT 2007
Thanks for Matt's tip, I tried this:
| @Destroy
| @Remove
| public void destroy() {
| UserTransaction tx = Transaction.instance();
| try {
| tx.begin();
| entityManager.remove(entityManager.merge(this.recipe));
| try {
| tx.commit();
| } catch (SecurityException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (IllegalStateException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (RollbackException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (HeuristicMixedException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (HeuristicRollbackException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| } catch (NotSupportedException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| } catch (SystemException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| }
|
And got a javax.transaction.NotSupportedException when trying to shut down the jboss during a mother conversation.
I wish Seam could provide something like @Begin(atomic = true). With this "atomic = true" flag on, if this conversation does not reach its own @end before time out or a application server crash, any insert/delete/update in the database could be rolled back, so that a long running conversation can map to an atomic database transaction and the correct semantic of an entity in the database can be guaranteed....Or if there is already something like this or there is some way I can achieve the atomic conversation behaviour, please let me know and I highly appreciate it!
For now I add a "status" flag in the database, my application is aware that only records with the status "created" or "updated" are semantically correct and usable.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064216#4064216
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4064216
More information about the jboss-user
mailing list