|
|
AbstractJpaTests and Spring 2.1 M4
Injection of EntityManagerFactory and sharedEntityManager is not working with 2.1 M4. I can run the same example with 2.1 M3. The following is the snippet :Code:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={quot;/appContext.xmlquot;})
@TransactionConfiguration(defaultRollback = true)
public class DummyTests extends AbstractJpaTests {
@Test public void testEntityManagerInjection() { AbstractRepositoryTests.assertInTransaction(true); System.out.println(entityManagerFactory); System.out.println(sharedEntityManager); }
}
The configuration xml is as follows:HTML Code:
lt;tx:annotation-driven transaction-manager=quot;transactionManagerquot;/gt; lt;bean class=quot;org..orm.jpa.support.PersistenceAnnotationBeanPostProcessorquot;/gt; lt;bean id=quot;entityManagerFactoryquot; class=quot;org..orm.jpa.LocalContainerEntityManagerFactoryBeanquot;gt; lt;property name=quot;dataSourcequot; ref=quot;dataSourcequot;/gt; lt;property name=quot;jpaVendorAdapterquot;gt; lt;bean class=quot;org..orm.jpa.vendor.HibernateJpaVendorAdapterquot; p:showSql=quot;truequot; p:generateDdl=quot;truequot;/gt; lt;/propertygt; lt;/beangt; lt;bean id=quot;dataSourcequot; class=quot;org..jdbc.datasource.DriverManagerDataSourcequot; p:driverClassName=quot;org.hsqldb.jdbcDriverquot; p:ucl=quot;jdbc:hsqldb:mem:testdb/quot; p:username=quot;saquot; p:password=quot;quot; /gt;
lt;bean id=quot;transactionManagerquot; class=quot;org..orm.jpa.JpaTransactionManagerquot; p:entityManagerFactory-ref=quot;entityManagerFactoryquot; p:dataSource-ref=quot;dataSourcequot; /gt;
With 2.1 M4, I get quot;nullquot; in both the cases, while with 2.1 M3 it gives finite values. Anybody facing similar issues ?
Cheers.
- Debasish |
|