fredag 21 december 2012

Issue when unit testing entities



When I was starting to build up a sample project for JPA for learning the Java EE suite I wanted to test that my entities where persisted correctly and for that I was using the inmemory database hsqldb. However when I was getting my persistence.xml set up correctly I still got the issue with: 

javax.persistence.PersistenceException: [PersistenceUnit: xxxx] Unable to build EntityManagerFactory ...

I googled around a bit, but couldn't really find the issue until the great source stackoverflow got me to the correct solution:

Just put in the property in your persistence.xml (in the persistence-unit you are using for testing):

<properties>
   <property name="javax.persistence.validation.mode" value="none"/>
   ...
</properties>

Don't know if this issue where related to using hibernate or not.

Will probably release my hobby-project to github soon.

Inga kommentarer:

Skicka en kommentar