0

How can I manually define the database path for an EclipseLink JTA DB?

<persistence>
    <persistence-unit name="myapp" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>jdbc/myapp</jta-data-source>
        <properties>
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
        </properties>
    </persistence-unit>
</persistence>

I'd like to use Squirrel Database tool to inspect the DB, therefore would like to specify the path...

Or is a JTA not ment to have a certain path, but just managed by the container in the background?

4

1 回答 1

1

您在容器中定义 JTA 数据源,然后容器负责将数据源放置在该位置以供提供者查找。jta-data-source 标签只是告诉提供者使用什么名称来查找它。

如果您不在容器中,那么在 JPA 2.0 中您将使用 javax.persistence.jdbc.url 属性来定义 URL。在此之前,您将使用供应商特定的属性(例如“eclipselink.jdbc.url”)来定义 Java SE 环境中的连接。

于 2013-10-08T16:32:46.577 回答