I have a problem that i'm stuck with and i would like some help.
I got a web-app and Hibernate
. I want to run my maven test from a different database schema, so i've wrote two different persistence.xml
files changing only this line :
<property name="hibernate.default_schema" value="myschema"/>
into this one :
<property name="hibernate.default_schema" value="myschematest"/>
I've placed it in the test folder so the new persistence.xml
will be loaded when i run my Maven Test. Everything goes well except for this thing:
Considering that my persistence.xml
is in the src/test forlder i don't know how to point my classes that are in the /src/main/... ?
src
--- main
------ java
--------- beans
------------ Application.java
------------ Derogation.java
------ resources
--------- META-INF
------------ persistence.xml
--- test
------ resources
--------- META-INF
------------ persistence.xml
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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/persistence_2_0.xsd">
<persistence-unit name="calamar" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.calamar.beans.Application</class>
<class>com.calamar.beans.Derogation</class>
[...]
Exception
testModifyApplication(test.TestApplicationService) Time elapsed: 0.06 sec <<< ERROR!
java.lang.IllegalArgumentException: Unknown entity: beans.Application
The line causing the exception
entityManager.persist(application);
Can someone help me?