I have a rather weird thing happening.
If I clean my target folder and run my tests they work fine. if I run it again without cleaning i get the following error
java.lang.IllegalArgumentException: Unknown entity: com.merc.domain.EventLog
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:675)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
Any ideas as to why this might happen when the target folder has just the compiled classes. I am using maven to build
For netbeans users this is an eye opener.
I have a maven project in netbeans. If i delete the files in target folder, and right click my test.java file in Netbeans and select “test file”. Netbeans runs the maven commands to build the file and the classpath and then executes the test using files in test-resources which works fine. But if the java classes are already compiled then Netbeans runs the tests with the resources from the classes folder instead of the test-classes folder. In my case, persistence.xml in classes-folder was missing a few details, which i didn’t care, because i was more focused on the unit tests.