I have a problem. I want to write an application using long running
transactions.
My usecase is with several steps:
1. I want to create and persist an object
2. This object is subsequently changed
3. At the end I want to save (flush) changes to the database.
To achieve this behavior I tried to use PersistentContext in EXTENDED mode. I
have written stateful session bean which implements all steps. This did not
work so I have tried how TraiBlazer application is working
In the module Runtime services ? Application transactions ? there is an example
of stateful session bean running with a persistent context in the extended
mode.
@Stateful
public class ApptransCalculator implements Calculator, Serializable {
@PersistenceContext(
type=PersistenceContextType.EXTENDED
)
protected EntityManager em;
// ... ...
}
In the example the flush and commit to the database should happen only when the
checkout method is called. In example the checkout method is called in the
update2.jsp (check.jsp). I have repacked the EJB3Trail.ear with some changes:
1. I enabled show_sql property for Hibernate.
2. I have changed the datasource to oracle.
I monitored the changes in the database after each step. I found out that it
behaves not as the example is trying to show. The click on update button on
update.jsp (calculator.jsp) writes to the database. Now the question is: Am I
understanding something wrong or is these just not working as it should? As I
understand flush should happen when checkout method (which is annotated with
@Remove) is called.
Thanks
Peter Repinc
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3924537#3924537
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3924537
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user