This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

There will be. We have some prototype code and as soon as the spec is final we will provide this support. I hope we will have something in the sandbox before that - I'll remind Juergen that we need this now

Comment

I'm playing around w/ it and it works quite well! I have just one problem regarding integration tests. I try to verify my JPA code with direct JDBC (via jdbcTemplate). I provide the connection details in my persistence.xml (no JNDI or JTA). Without defing a dataSource bean in my app ctx, jdbcTemplate can't be initialized. Defining a BasicDataSource makes the jdbcTemplate work, but IMO not in the same session/transaction with JPA. The persisted (and flushed but uncommited) JPA-changes are not visible via jdbcTemplate queries (in the same test method). The same approach works for my "classic" hibernate tests.

Any ideas? Something I'm doing wrong?

Sebastian

Comment

Comment

Are you using Hibernate Entity Manager as your JPA implementation? If so, would you mind sharing your code? I'm just getting started with Spring's JPA support and would love to see what you've managed so far.

Comment

Your "classic" hibernate tests were probably sharing the same db resource (conenction) and could have been sharing the same transaction because of a non-JTA setup.

The JPA stuff may be using JTA transactions that scope the EntityManager's context to the JTA transaction. "Breaking in" to this transaction with another connection would not be possible.

You may be able to set your underlying transaction isolation level for all database connections to "READ_UNCOMMITED". This should allow your JDBC connection to observe the uncommitted results of the JPA-based transaction.

getEntityManager() is null. I can force creation of it by EntityManagerFactory.createEntityManager(), but them I'm faced with

Code:

javax.persistence.TransactionRequiredException: no transaction is in progress
at org.hibernate.ejb.AbstractEntityManagerImpl.checkTransactionActive(AbstractEntityManagerImpl.java:130)
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:145)
at com.springdeveloper.service.BeerDistributorServiceJpa.saveCustomer(BeerDistributorServiceJpa.java:48)

I'm using the JpaTransactionManager as supplied in the sample code, but it doesn't seem to create a new tx when required.

Comment

Is the JPA preview code still available? I noticed that it was removed from CVS by robharrop on 12/7/05 with the comment "Removed old JPA code". Has this code simply been moved elsewhere and if so where?