Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-dev] persistence.xml and "external jars"

Jean,

Since you can't log into the forum I'll post a response here.

Please take a look at the following links for more info on this particular case:

http://www.eclipse.org/forums/index.php/t/368151/

https://bugs.eclipse.org/bugs/show_bug.cgi?id=254480

The short story is that this capability isn't currently supported in Dali.   The only workaround at this point would be to have redundant persistence.xml files defined in the "jar" projects at design time, and these would need to be removed in the packaging step to ensure the correct deployment artifacts.  Not a great solution, but this is the only workaround I can think of at the moment.   Some have considered contributing to a solution in this area but nothing has come of this so far.  We would welcome any contributions in this area.

Neil

On 10/25/2013 3:52 AM, Jean Couillaud wrote:
First of all, I am sorry for the cross post, but I really think members of both projects might be helpful.

My persistence.xml is like the following :

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
<persistence-unit name="test" transaction-type="JTA">

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<jta-data-source>java:/testDS</jta-data-source>
<jar-file>../WEB-INF/lib/jar1-1.0.6-SNAPSHOT.jar</jar-file>
<jar-file>../WEB-INF/lib/jar2-1.0.6-SNAPSHOT.jar</jar-file>

....

Although these jar-file definitions are valid with regard to at least the JEE6 (JPA2) spec, eclipse can't find the projects (even if they are open in the workspace).
I can think of several ways it could be done.

First solution : I tried to use an ear. I placed the persistence.xml in a dedicated jar (containing solely the file, not the entities). In that setup, I had removed the "WEB-INF/lib/" part. Although it worked in JBoss, it does not in eclipse. In my opinion, since the ear knows its dependencies, wtp should be able to resolve all persistence jars

Second solution (that's why I am cross-posting in this ML), m2e-wtp might be used as an additional persistence jar resolver by looking for artifacts matching the finalName jar name.

Is this already possible another way ?
Would there be a way to do this in near future ?
Would there be a complex work-around ?

PS : I should add that any advice on puting the persistence.xml in the same jar as the entities would be irrelevant to us, both for pratical reasons and for external architectural reasons.

PS2 : I am sorry I am not first posting to the eclipse user forums since I seem to encounter some authentication issue I do not see any solution to and there seems to be no users mailing lists any more.

Thx in advance, even for simple pointers.
Jean Couillaud


_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev


Back to the top