I am trying to get rid of the typical persistence.xml
file in Spring JPA web application. So far, I have managed to inject the EntityManager
successful
Spring provides a way to configure these options in provider-independent way using AbstractJpaVendorAdapter
(setDatabase()
and setGenerateDdl()
, though setGenerateDdl()
doesn't take DDL mode).
Alternatively, you can pass arbitrary properties to LocalContainerEntityManagerFactory
using setJpaProperties()
(or setJpaPropertyMap()
):
Properties props = new Properties();
props.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
props.put("hibernate.hbm2ddl.auto", "create");
factoryBean.setJpaProperties(props);