Java Reference
In-Depth Information
The following code demonstrates how to generate tables regardless of the creation
of the EntityManagerFactory :
Map props = new HashMap();
props.put("javax.persistence.schema-generation.database.action",
"create");
props.put("javax.persistence.schema-generation.create-source",
"metadata");
Persistence.generateSchema("chapter04PUM",
props);
The following code demonstrates another way to generate the tables at the creation
of the EntityManagerFactory :
Map props = new HashMap();
props.put("javax.persistence.schema-generation.database.action",
"create");
props.put("javax.persistence.schema-generation.create-source",
"metadata");
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("chapter04PUM",
props);
Search WWH ::




Custom Search