-
Jun 2nd, 2009, 02:46 AM
#1
3.0.0M3: How to configure JPA EntityManagerFactory ?
So far I figured out the following config methods. However, I've no idea how to obtain an EntityManagerFactory using the annotations provided in 3.0.0M3. Any hint is appreciated!
@Bean(destroyMethod="close")
public DataSource dataSource() {
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName(...);
ds.setUrl(...);
ds.setUsername(...);
ds.setPassword(...);
ds.setMaxActive(...);
ds.setMinIdle(...);
return ds;
}
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
return new HibernateJpaVendorAdapter();
}
@Bean
public LoadTimeWeaver loadTimeWeaver() {
return new InstrumentationLoadTimeWeaver();
}
@Bean
public EntityManagerFactory entityManagerFactory() {
LocalContainerEntityManagerFactoryBean emfBean = new LocalContainerEntityManagerFactoryBean();
emfBean.setDataSource(dataSource());
emfBean.setJpaVendorAdapter(jpaVendorAdapter());
emfBean.setLoadTimeWeaver(loadTimeWeaver());
EntityManagerFactory emf = ??? // How do I proceed ???
return emf;
}
@Bean
public PlatformTransactionManager transactionManager() {
return new JpaTransactionManager(entityManagerFactory());
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules