Extending environment variable in persistence.xml (JPA)
I am developing an Eclipse RCP plugin that uses JPA. I tried to specify the database path through a variable that the JVM gives at 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 way to fix this?
thanks
+2
a source to share
1 answer
This should work, but only for JVM variables, not OS / Shell environment variables. For your example to 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 startup command line.
+2
a source to share