Change values in persistence.xml from within the p

2019-08-06 11:58发布

Is it possible to change values in persistence.xml from within the program that is using it ? If yes, i would appreciate some hints or/and links to read.

2条回答
相关推荐>>
2楼-- · 2019-08-06 12:00

Yes

    // 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
    ));
查看更多
唯我独甜
3楼-- · 2019-08-06 12:24

not part of jpa spec, so no. some implementations may allow some updates ... e.g dayanucleus http://www.datanucleus.org/products/accessplatform_3_0/jpa/persistence_unit.html but what do u want to change?

查看更多
登录 后发表回答