0
Relative path of database in persistence.xml
I create this property in my persistence.xml file: This works fine: <property name=“hibernate.connection.url” value=“jdbc:h2:file:D:/data/mydb”/> But when i change my path to relative like below it is not work, and dont find my database tables: <property name=“hibernate.connection.url” value=“jdbc:h2:file:./data/mydb”/> What is the problem?
1 Resposta
+ 1
Try this
<persistence-unit name="h2" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
<property name="hibernate.connection.driver_class" value="org.h2.Driver" />
<property name="hibernate.connection.url" value="jdbc:h2:target/h2-1" />
<property name="hibernate.connection.user" value="sa" />
<!-- <property name="hibernate.show_sql" value="true"/>
<property name="hibernate.flushMode" value="FLUSH_AUTO" />-->
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>