سؤال

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?

هل كانت مفيدة؟

المحلول

You define the JTA-datasource in the container, which is then responsible for placing the datasource at that location for the provider to lookup. The jta-data-source tag just tells the provider what name to use to look it up with.

If you are not in a container, in JPA 2.0 you would use the javax.persistence.jdbc.url property to define the URL. Prior to that you would use vendor specific properties such as "eclipselink.jdbc.url" to define the connection in a java SE environment.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top