开发者

Environment variable expansion in persistence.xml (JPA)

I am developing a Eclipse RCP plugin which uses JPA. I tried to specify the database path via a variable give to the JVM 开发者_JS百科on runtime. The property is set correctly but the database is created in a folder named after the variable name (here: ${DBHOME}).

<property name="javax.persistence.jdbc.url" value="jdbc:derby:${DBHOME};create=true"/>

Is there a possibility to fix this?

Thx


That should work but only for JVM variables, not OS/Shell environment variables. To make your example work, you need to start the JVM with -DDBHOME=your/path.

To make this work with shell variables, you need to add -DDBHOME=$DBHOME (*nix) or -DDBHOME=%DBHOME% (win) to the JVM launch command line.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜