2011-06-15 55 views
1

是否可以在使用它的程序中更改persistence.xml中的值?如果是的話,我會感激一些提示或/和鏈接閱讀。在程序中更改persistence.xml中的值

+0

難道我的答案的工作?我希望它有幫助。也許你想接受它,如果這樣做? – 2011-07-28 21:43:28

回答

4

// connect to database 
    log.info("Connecting to database @ " + dbUrl + " using " + dbUser + "/" + dbPass); 
    emf = Persistence.createEntityManagerFactory("manager", Maps.create(
      "javax.persistence.jdbc.user", dbUser, 
      "javax.persistence.jdbc.password", dbPass, 
      "javax.persistence.jdbc.url", dbUrl 
    ));