Search code examples
mongodbhibernatejpajtahibernate-ogm

Hibernate OGM com MongoDB and JTA on Glassfish - javax.persistence.PersistenceException


Using Hibernate OGM, MongoDB and JTA on Glassfish 4.1. When a try to persist a get an error with this:

Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter

and

Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String field br.com.juliocnsouza.mongojpaexemple.model.Developer.id to br.com.juliocnsouza.mongojpaexemple.model.Developer

Solution

  • After try everythig I found on the internet. The solution was stop using Hibernate OGM e try Eclipselink NoSQL. Just added a new dependency and changed some parts of my persistence xml and now its working just fine!

    https://wiki.eclipse.org/EclipseLink/Examples/JPA/NoSQL

    <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.nosql</artifactId> <version>2.6.0-M3</version> </dependency>

    simple exemple project: https://github.com/juliocnsouzadev/hibernateMongoDB/tree/master/OgmJpaMongodbEclipseLink