0

Does EclipseLink have something equivalent to openjpa.properties that let's me specify the location of persistence.xml?

Is tweaking the classpath to find persistence.xml the only option for EclipseLink?

FWIW this is a Spring 4. application

TIA.

Mike Summers
  • 2,139
  • 3
  • 27
  • 57
  • 2
    possible duplicate of [Is it possible to have persistence.xml in a location other than META-INF?](http://stackoverflow.com/questions/13717324/is-it-possible-to-have-persistence-xml-in-a-location-other-than-meta-inf) – Tassos Bassoukos Jul 30 '14 at 03:10
  • 1
    Somewhat, that question does lead to the correct answer below. – Mike Summers Jul 30 '14 at 13:38

1 Answers1

1

The answer for a Spring-based app is

    <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" />
    <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
            <property name="persistenceUnitName" value="persistenceUnit" />
            <property name="persistenceXmlLocation" value="file:<Path to your persistence.xml>" />
            <property name="dataSource" ref="dataSource" />
    </bean>
Mike Summers
  • 2,139
  • 3
  • 27
  • 57