0
我建立一个使用h2
数据库的应用程序,我persistence.xml
如何设置一个可移植的persistence.xml文件?
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="taskUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.github.tarrsalah.jersey.todo.app.model.Task</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:h2:file:/home/tarrsalah/src/github.com/tarrsalah/jaxrs-todo-app/target/todo"/>
<property name="javax.persistence.jdbc.user" value=""/>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="javax.persistence.jdbc.password" value=""/>
</properties>
</persistence-unit>
</persistence>
正如你可以看到我有javax.persistence.jdbc.url
属性设置为本地h2
数据库中的硬链接,我想分享在github上我的代码。
如何在不更改persistence.xml
配置文件的情况下制作我的代码的克隆版本?
(PS:我使用的数据库迁移迁徙路线)
如何飞路迁移? – tarrsalah 2014-11-21 04:56:47
AFAIK飞路迁移工作在h2内存数据库中。看看这里http://stackoverflow.com/questions/21019874/table-not-found-after-apparently-successful-migration – Shailendra 2014-11-21 05:03:21
@Shailendar迁移成功使用maven flyway插件,但似乎eclipseLink无法找到它(我使用相同的URL)。 – tarrsalah 2014-11-21 05:10:11