Guest User

Untitled

a guest
Aug 16th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. // Config
  2. H2 database, server mode
  3. C3P0 pool
  4. Hibernate 3.6
  5.  
  6. // In hibernate.cfg.xml
  7. <mapping class="com.company.model.User"/>
  8.  
  9. // Class
  10. @Entity
  11. @Table(name="USER")
  12. public class User {
  13.     private String login;
  14.     private String password;
  15.     private String role;
  16. }
  17.  
  18. // Code to generate schema
  19. Configuration config = new Configuration();
  20. config.configure();
  21. SchemaExport schemaExport = new SchemaExport(config);
  22. schemaExport.create(true, true);
  23.  
  24. // Log
  25. 18:49:14,509  INFO SchemaExport:262 - exporting generated schema to database
  26. 18:49:14,513  INFO ConnectionProviderFactory:173 - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
  27. 18:49:14,514  INFO C3P0ConnectionProvider:103 - C3P0 using driver: org.h2.Driver at URL: jdbc:h2:tcp://localhost/resanet
  28. 18:49:14,514  INFO C3P0ConnectionProvider:104 - Connection properties: {user=sa, password=****}
  29. 18:49:14,514  INFO C3P0ConnectionProvider:107 - autocommit mode: false
  30. 18:49:14,771  INFO SchemaExport:281 - schema export complete
Add Comment
Please, Sign In to add comment