0

在 Glassfish 4.1 上使用 Hibernate OGM、MongoDB 和 JTA。当尝试坚持一个错误时:

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

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
4

1 回答 1

0

在尝试了我在互联网上找到的所有内容之后。解决方案是停止使用 Hibernate OGM 并尝试使用 Eclipselink NoSQL。刚刚添加了一个新的依赖项并更改了我的持久性 xml 的某些部分,现在它工作得很好!

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>

简单的示例项目:https ://github.com/juliocnsouzadev/hibernateMongoDB/tree/master/OgmJpaMongodbEclipseLink

于 2015-02-17T16:19:10.420 回答