Handle Transaction on differents EARs
what is the best practice to handle multiple EARs and the same transaction, as far 开发者_Python百科as we know we need to apply XA concepts in order transaction works correctly. but apparently in currents project that we've been working on, this is not strictly necessary for creates and updates; however if we try to retrieve any collection from an entity we get an error that say there its not an active transaction or it was closed, but if we update Entity A in Ear A and update Entity B in Ear B it works perfectly when Entity A and Entity B has different datasources, at this point we are so confused about that, because we haven't configure any xa datasource yet. how is the best approach to work with this. transaction are handles by beans and not by the container and datasource are different between EAR A and EAR B
When you want to work with multiple resources (databases, JMS resources, JCA connectors) in a single transaction, you need an XA transaction (also know as a "global transaction). An XA transaction involves a JTA transaction manager for the coordination through the two-phase commit (2PC) protocol. For more details on XA, see this wonderfull XA Exposed post from Mike Spille.
(...) if we update Entity A in Ear A and update Entity B in Ear B it works perfectly when Entity A and Entity B has different datasources
How do you perform that update (I mean, from where)? What do you mean exactly by "it works"? Are you sure both updates are rollbacked in case of problem? Without using a global transaction, I'd be surprised if they are. Can you clarify this a bit?
精彩评论