users@glassfish.java.net

Re: JPA (TopLink Implementation) transaction rollback behaviour

From: <glassfish_at_javadesktop.org>
Date: Mon, 21 Jan 2008 00:47:00 PST

I am sorry but this isn;t the case :) The exception is raised when commit() is executed (because of persist(D) of course), not when persist(D) is executed. If the transaction was to be destroyed I would expect A,B,C persists to be rollbacked which does not happen.

Anyway, I found the root of the problem! When Toplink works with a JTA datasource, then it doesnt control the transactions itself. I guess the connection it gets from the pool must be registered with a transaction controller. This is because when I altered my datasource and declared it as non JTA and RESOURCE.LOCAL, the code executed fine, as expected.

The problem is why could I not register my SQL Server 2005 Datasource with a Transaction Controller, with autocommit set to false? Why do have I to declare it non JTA in persistence.xml in order for my transaction to behave normally?
[Message sent by forum member 'thehunt' (thehunt)]

http://forums.java.net/jive/thread.jspa?messageID=254940