Guest User

Untitled

a guest
Dec 13th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. public static void main(String[] args) {
  2. EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
  3. SessionFactoryImpl sessionFactory = null;
  4. try {
  5. Persistence.generateSchema(PERSISTENCE_UNIT, null);
  6. } finally {
  7. sessionFactory = emf.unwrap(SessionFactoryImpl.class);
  8. sessionFactory.getServiceRegistry().destroy();
  9. }
  10. }
  11.  
  12. <?xml version="1.0" encoding="UTF-8"?>
  13. <persistence version="2.1"
  14. xmlns="http://xmlns.jcp.org/xml/ns/persistence"
  15. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  16. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
  17. http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  18. <persistence-unit name="ddl-gen">
  19. <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
  20.  
  21. <class>***</class>
  22. <class>***</class>
  23. <class>***</class>
  24.  
  25. <properties>
  26.  
  27.  
  28. <property name="javax.persistence.schema-generation.scripts.action" value="create"/>
  29. <property name="javax.persistence.schema-generation.scripts.create-target"
  30. value="${project.basedir}/src/main/resources/META-INF/sql/init.sql"/>
  31. <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
  32. <property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://***/~/***"/>
  33. <property name="hibernate.connection.username" value="sa"/>
  34. <property name="hibernate.connection.password" value=""/>
  35.  
  36.  
  37.  
  38. </properties>
  39.  
  40. </persistence-unit>
  41.  
  42. </persistence>
  43.  
  44. 16:11:41.062 [main] DEBUG org.hibernate.internal.SessionFactoryRegistry - Not binding SessionFactory to JNDI, no JNDI name configured
  45. 16:11:41.062 [main] DEBUG org.hibernate.jpa.internal.schemagen.JpaSchemaGenerator - wasInitiallyAutoCommit=false
  46. 16:11:41.062 [main] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
  47. 16:11:41.066 [main] DEBUG org.hibernate.service.internal.AbstractServiceRegistryImpl - Implicitly destroying ServiceRegistry on de-registration of all child ServiceRegistries
  48. 16:11:41.066 [main] INFO org.hibernate.orm.connections - HHH10001008: Cleaning up connection pool [jdbc:h2:tcp://***/~/***]
  49. 16:11:41.067 [main] DEBUG org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl - Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries
  50. 16:12:10.932 [pool-2-thread-1] DEBUG org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - Connection pool now considered primed; min-size will be maintained
  51.  
  52. public static void main(String[] args) {
  53. Persistence.generateSchema(PERSISTENCE_UNIT, null);
  54. }
  55.  
  56. 16:07:26.890 [main] DEBUG org.hibernate.internal.SessionFactoryRegistry - Not binding SessionFactory to JNDI, no JNDI name configured
  57. 16:07:26.895 [main] DEBUG org.hibernate.jpa.internal.schemagen.JpaSchemaGenerator - wasInitiallyAutoCommit=false
  58. 16:07:26.896 [main] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
  59. 16:07:54.274 [pool-1-thread-1] DEBUG org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - Connection pool now considered primed; min-size will be maintained
Add Comment
Please, Sign In to add comment