Hi,

I hope that I understand everything in the right way. Seam always starts and 
commits 2 Tx for each request. By default flush type of AUTO, hibernate entity 
manager will also commit the 2 txs. (Is there an optimization to handle the 
second tx for render response phase in a read-only mode? Don't think it is 
always reasonable, but just curious to know) In a long-running conversation 
over several request, this commitment of tx leads to a database flush, which is 
actually not wished. So the right strategy is to use the manual flush mode and 
flush explicitly at the end of conversation. 

I hope I got the right understanding so far. It will be great if you guys can 
give a short conformation.

Now my question: I am using Seam in a layered architecture, in which the I 
would not like to expose the entity manager into the JSF layer. I know this is 
not the Seam philosophy, but it is a fact. Do you have a suggestion, how I can 
handle this manual flush at the end of the conversaton in a elegant way. 

Option 1 is to define corresponding methods in "service backend" (for @End), 
which always invoke entityManager.flush(). This could limit the reusability of 
these methods, because they can be used in environments where auto flush is 
more appropriate.
Option 2 is to introduce a FlushService, which can be used by JSF beans to 
start the flush. But I don't like this idea either, because it is really not 
natural. 

I am really keen to know whether you have better ideas. 

Thx in advance.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103743#4103743

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103743
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to