Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Testing Eclipslink JPA using Spring-managed transaction and Junit4

Testing EclipseLink JPA CRUD methods in JUnit3.8, using the Spring Test
Framework and AbstractJpaTests, writes changes to the database when I use
AbstractJpaTests.setComplete() and  AbstractJpaTests.endTransaction().

However, when I switch to Junit4, and use
@RunWith(SpringJUnit4ClassRunner.class) annotation instead of extending
AbstractJpaTests, there are no setComplete() or endTransaction() methods
available to commit the transaction.

In fact, the Spring documentation indicates that transaction management is
completely managed by the Spring IoC container. But it just doesn't commit,
even when configured correctly. In my setup, non-CRUD methods, such as
findById and executeQuery all work fine, and the CRUD methods do update the
EntityManager cache, but there just doesn't appear to be any flushing to
commit the changes to the database.

Could this be a problem because I'm using EclipseLinkJpaVendorAdapter to
configure my EntityManagerFactory bean?

I'm running my tests with the Spring Transactional annotation with no
special settings.

Anyone have experience testing EclipseLink JPA using
SpringJunit4ClassRunner? 
-- 
View this message in context: http://www.nabble.com/Testing-Eclipslink-JPA-using-Spring-managed-transaction-and-Junit4-tp20080899p20080899.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top