28 octubre 2009

programmatic persistence properties in JPA

JPA also supports programmatic configuration, with a map of options:

Map myProperties = new HashMap();
myProperties.put("hibernate.hbm2ddl.auto", "create-drop");
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("helloworld", myProperties)

Custom programmatic properties override any property you’ve set in the persis-
tence.xml configuration file.

No hay comentarios: