Guest User

Untitled

a guest
Jan 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. GeronimoTransactionManager transactionManager = (GeronimoTransactionManager) OpenEJB.getTransactionManager();
  2.  
  3. Properties props = new Properties();
  4. props.setProperty("driverClassName", "com.mysql.cj.jdbc.Driver");
  5. props.setProperty("url", "jdbc:mysql://localhost/test");
  6. props.setProperty("password", "test");
  7. props.setProperty("passwordCipher", "PlainText");
  8. props.setProperty("username", "test");
  9.  
  10. try {
  11. DataSource underlying = new org.apache.tomcat.jdbc.pool.DataSourceFactory().createDataSource(props);
  12. dataSource = new ManagedDataSource(underlying, transactionManager, transactionManager);
  13. } catch (Exception e) {
  14. e.printStackTrace();
  15. }
  16.  
  17. Map properties = new HashMap<>();
  18.  
  19. StringWriter create = new StringWriter();
  20.  
  21. properties.put("javax.persistence.schema-generation.scripts.action", "create");
  22. properties.put("javax.persistence.schema-generation.scripts.create-target", create);
  23.  
  24. Persistence.generateSchema("router", properties);
Add Comment
Please, Sign In to add comment