On Aug 4, 2008, at 2:49 AM, Marcin Kwapisz wrote:

Hi,

Configuration: OpenEJB 3.0, ToplinkEssentials 2.1, Maven2, JUnit 4, Derby 10.2.2

I have modified that example -> 
http://openejb.apache.org/3.0/testing-transactions-example.html
to use Toplink as persistence provider. The problem is, that Toplink does not persists entities at all. With OpenJPA or Hibernate all work fine.

As You may see below, sequences are updated properly.

[TopLink Finest]: 2008.08.04 11:17:31.359--ServerSession(13948523)-- Thread(Thread[main,5,main])--end deploying Persistence Unit barPU; state Deployed; factoryCount 1 [TopLink Finer]: 2008.08.04 11:17:31.406--ServerSession(13948523)-- Thread(Thread[main,5,main])--client acquired [TopLink Finest]: 2008.08.04 11:17:31.406--UnitOfWork(19780920)-- Thread(Thread[main,5,main])--Execute query DoesExistQuery() [TopLink Finest]: 2008.08.04 11:17:31.406--UnitOfWork(19780920)-- Thread(Thread[main,5,main])--PERSIST operation called on: pl.zsk.samples.ejbaccess.entities.Person[id=null;Marcin]. [TopLink Finest]: 2008.08.04 11:17:31.406--ClientSession(9876930)-- Thread(Thread[main,5,main])--Execute query DataModifyQuery() [TopLink Finest]: 2008.08.04 11:17:31.406--ClientSession(9876930)-- Thread(Thread[main,5,main])--reconnecting to external connection pool [TopLink Fine]: 2008.08.04 11:17:31.406--ClientSession(9876930)-- Connection(7789321)--Thread(Thread[main,5,main])--UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
       bind => [50, PERSONENT]
[TopLink Finest]: 2008.08.04 11:17:31.421--ClientSession(9876930)-- Thread(Thread[main,5,main])--Execute query ValueReadQuery() [TopLink Fine]: 2008.08.04 11:17:31.421--ClientSession(9876930)-- Connection(7789321)--Thread(Thread[main,5,main])--SELECT SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = ?
       bind => [PERSONENT]
[TopLink Finest]: 2008.08.04 11:17:31.421--ClientSession(9876930)-- Connection(7789321)--Thread(Thread[main,5,main])--local sequencing preallocation for PERSONENT: objects: 50 , first: 1, last: 50 [TopLink Finest]: 2008.08.04 11:17:31.421--UnitOfWork(19780920)-- Thread(Thread[main,5,main])--assign sequence to the object (1 -> pl.zsk.samples.ejbaccess.entities.Person[id=null;Marcin]) 2008-08-04 11:17:31 pl.zsk.samples.ejbservice.AccountEntBeanTest testCreatePersonEnt
INFO: Get Persons from Database.
[TopLink Finest]: 2008.08.04 11:17:31.531--UnitOfWork(19780920)-- Thread(Thread[main,5,main])--Execute query ReportQuery(pl.zsk.samples.entities.PersonEnt) [TopLink Finest]: 2008.08.04 11:17:31.546--ServerSession(13948523)-- Thread(Thread[main,5,main])--reconnecting to external connection pool [TopLink Fine]: 2008.08.04 11:17:31.546--ServerSession(13948523)-- Connection(13305839)--Thread(Thread[main,5,main])--SELECT ID, FIRSTNAME, LASTNAME FROM PERSONENT
[]
2008-08-04 11:17:31 pl.zsk.samples.ejbservice.AccountEntBeanTest testCreatePersonEnt
INFO: []

When I call flush just after persist I get the EJBException:

javax.ejb.EJBException: The bean encountered a non-application exception.; nested exception is: javax.ejb.EJBTransactionRolledbackException: The transaction has been marked rollback only because the bean encountered a non- application exception :javax.persistence.TransactionRequiredException :
Exception Description: No transaction is currently active

This is strange. Why transaction does not begin? Any suggestions how to configure Toplink to make it work.
Thanks in advance

It may be that TopLink doesn't know how to find our TransactionManager. OpenJPA finds it automatically by calling org.apache.openejb.OpenEJB.getTransactionManager(). For Hibernate, there's the TransactionManagerLookup which can be configured. Do you know if there's anything similar in TopLink?

-David

Reply via email to