Hibernate version: 3.2.2.ga
Hibernate annotation/entity manager: 3.2.1.ga
Note: I have two projects; the common code in one jar file, and the project I am working on (a webapp), which contains the persistence.xml.
persistence.xml:
<?xml version='1.0'?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd" version="1.0">
<persistence-unit name="default">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jar-file>WEB-INF/lib/xware-common-2.0-SNAPSHOT.jar</jar-file>
</persistence-unit>
</persistence>
The problem(s):
The first problem, while annoying, is at least fixable. When using junit and Hibernate/JPA, I had to hardcode the link to the jar-file reference, otherwise it will not find it on the classpath. Is there a way to get that to work, so that I don't need to keep hacking the persistence file for use with JUnit, and then fixing it for deployment?
The second problem is the one I have not found a workaround for. When I do change the persistence.xml jar-file mapping to hardcode the link to the library, the entity manager no longer sees the annotated classes in the project with the unit tests. How can I fix that?