Does your TxMgrProvider provide a correctly functioning TransactionManager? OpenJPA will register a Synchronization with it, which should get committed when your global transaction is committed.
It does, I directly provide JOTM transaction manager. The same code works correctly with Hibernate as far as transaction handling is concerned. My managedRuntime impl is just: public class TxMgrProvider implements ManagedRuntime { public TxMgrProvider() { } public TransactionManager getTransactionManager() throws Exception { return _txMgr; } } Do you see any log messages at all when you commit the global
transaction?
No I don't. I only see some selects here and there. For example there should be a commit between the 2 following selects: 58194 ode-dao TRACE [Thread-4] openjpa.Query - Executing query: select p from ProcessDAOImpl p 58205 ode-dao TRACE [Thread-4] openjpa.jdbc.SQL - <t 21912919, conn 30031746> executing prepstmnt 8828117 SELECT t0.PROCESS_ID, t0.VERSION, t0.CONNECTION_ID, t0.GUID, t0.NUMBER_OF_INSTANCES, t0.PROCESS_KEY, t0.PROCESS_TYPE FROM ODE_PROCESS t0 58206 ode-dao TRACE [Thread-4] openjpa.jdbc.SQL - <t 21912919, conn 30031746> [1 ms] spent 58206 ode-dao TRACE [Thread-4] openjpa.jdbc.JDBC - <t 21912919, conn 30031746> [0 ms] close 58208 ode-dao TRACE [Thread-4] openjpa.Query - Executing query: select p from ProcessDAOImpl p 58208 ode-dao TRACE [Thread-4] openjpa.jdbc.SQL - <t 21912919, conn 13257390> executing prepstmnt 15527192 SELECT t0.PROCESS_ID, t0.VERSION, t0.CONNECTION_ID, t0.GUID, t0.NUMBER_OF_INSTANCES, t0.PROCESS_KEY, t0.PROCESS_TYPE FROM ODE_PROCESS t0 58209 ode-dao TRACE [Thread-4] openjpa.jdbc.SQL - <t 21912919, conn 13257390> [0 ms] spent 58209 ode-dao TRACE [Thread-4] openjpa.jdbc.JDBC - <t 21912919, conn 13257390> [0 ms] close Thanks, Matthieu On Jan 15, 2007, at 10:35 AM, Matthieu Riou wrote:
> Hi, > > I now have a working setup (at least something that starts) using a > programmaticaly provided datasource and transaction manager. Here > is the > code now: > > HashMap propMap = new HashMap(); > propMap.put("openjpa.jdbc.DBDictionary", " > org.apache.openjpa.jdbc.sql.DerbyDictionary"); > propMap.put("openjpa.ManagedRuntime", new TxMgrProvider()); > propMap.put("openjpa.ConnectionFactory", _datasource); > propMap.put("openjpa.Log", "DefaultLevel=TRACE"); > EntityManagerFactory emf = > Persistence.createEntityManagerFactory("ode-dao", > propMap); > HashMap propMap2 = new HashMap(); > propMap2.put("openjpa.TransactionMode", "managed"); > EntityManager em = emf.createEntityManager(propMap2); > _daoCF = new BPELDAOConnectionFactoryImpl(em); > > I've tried both with and without the propMap2, in both cases I > never get > OpenJPA to commit (and therefore no insert/update/delete) when I > commit the > transaction. > > Any idea of what could be wrong? > > Thanks! > > Matthieu