JPA configuration should support configurationfile as a way to do overrides the persistence.xml location

Description

JPA configuration should support configurationfile as a way to do overrides the persistence.xml location, like:

<target name="hbm2ddl">
<hibernatetool destdir="${src-hbmtools.dir}">
<jpaconfiguration configurationfile="META-INF/${database}/persistence.xml"/>
<classpath location="${build.classes.dir}"/>
<hbm2ddl export="false" outputfilename="${module.name}.ddl" format="true" haltonerror="true"/>
</hibernatetool>
</target>

When I try it, I got "<jpaconfiguration> currently only support autodiscovery from META-INF/persistence.xml. Thus setting the configurationfile attribute is not allowed"

Environment

None

Activity

Show:
Max Rydahl Andersen
October 2, 2007, 10:30 PM

then make me the favor and go into that and tell me how they workaround that part of the jpa spec. (if it is not classloader tricks then I would really love to hear about it)...in any case - a patch will be the best.

Max Rydahl Andersen
October 7, 2007, 8:17 PM

Actually they do it in a different way:
"Internally, this FactoryBean parses the persistence.xml file itself and creates a corresponding PersistenceUnitInfo object (with further configuration merged in, such as JDBC DataSources and the Spring LoadTimeWeaver), to be passed to the chosen JPA PersistenceProvider. This corresponds to a local JPA container with full support for the standard JPA container contrac"

I will look into that; it's a hack but it's a better hack than classloaders

James Olsen
May 13, 2008, 1:40 PM

Would it also be possible to add the corresponding support for non standard persistence.xml file names/locations in the Eclipse Hibernate Configurations editor?

I have much the same issue. I use Spring so that I can run in a non-EJB3 container but have to use a non-standard name so that EJB3 aware containers don't find them.

Max Rydahl Andersen
May 13, 2008, 2:08 PM

James - that is what this feature request is about....allowing you to point to another persistence.xml

Geoffrey De Smet
August 22, 2008, 11:29 AM

This is a blocker for us too, our files are like
META-INF/full-persistence.xml
META-INF/light-persistence.xml
...

Assignee

Unassigned

Reporter

Leonardo Pinho

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Affects versions

Priority

Blocker
Configure