There are two use cases where we DMS will use the UserTransaction.   

 

1)       When your assembler has "use-transactions=true", and you commit
a change or batch of changes, the DMS code will start a transaction
before calling your createItem, updateItem, and deleteItem methods.  If
any of those get an error, the transaction is rolled back and all of the
changes are put back into the uncommitted list on the client.   If they
all succeed the transaction is committed and the changes pushed to other
interested clients.

 

2)       If you use the DataServiceTransaction api to push changes from
the server, when you call begin you can pass in a value of "true" which
causes the DMS stuff to start a JTA transaction in that call.   When you
call commit, the JTA transaction is committed if the setRollbackOnly
call was not made.   This is just a convenience if you happen to have
some JDBC code which is updating the database.  You want to both commit
those changes and push the changes to other clients or rollback those
changes and cancel those changes.

 

For 1), when you are also using Hibernate, the hibernate assembler will
register a hibernate current session context class.   The goal of this
class is to ensure that we create one hibernate session for each JTA
transaction we create for DMS and commit/roll them back in sync.  Going
forward I'd like to offer another way to do this so that we can more
flexibly integrate with other ways of using hibernate sessions.  

 

Jeff

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of den.orlov
Sent: Wednesday, December 12, 2007 2:10 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex Data Management and container's
UserTransaction

 

As I understand Flex Data Management Services require that application
container provide UserTransaction for it. But I can't find any guide
about how FDMS uses it.

I was completely confused when I checked several tutorials that used
FDMS+HibernateAssempler+Spring or FDMS+hand written
Assempler+Hibernate+Spring. 

That tutorial 
http://blogs.adobe.com/mtg/2006/08/my_first_hibernate_enabled_fle.html
<http://blogs.adobe.com/mtg/2006/08/my_first_hibernate_enabled_fle.html>

specify that Hibernate's SessionFactory use datasource not tied to
global transaction manager.

This tutorials:
http://devblog.ezmo.com/2007/05/29/using-flex-data-services-with-spring-
and-hibernate/
<http://devblog.ezmo.com/2007/05/29/using-flex-data-services-with-spring
-and-hibernate/> 
http://iamjosh.wordpress.com/2007/11/08/building-a-livecycle-data-servic
e-application/
<http://iamjosh.wordpress.com/2007/11/08/building-a-livecycle-data-servi
ce-application/> 
don't specify that SessionFactory should use global transaction scope
for Session and use local transaction management.

So what's the purpose of FDMS to have reference to container's
UserTransaction?

Den

 

Reply via email to