springBoot整合Neo4j,出现Can not set java.lang.Long field,请大神指导。
发布于 5 年前 作者 dapengzhu 2962 次浏览 来自 问答

同样的代码,理论上成功运行且导入到图数据库了。

今天再次运行发现问题如下,请大神给予指导,谢谢!

2019-12-05 [http-nio-8080-exec-1] INFO org.neo4j.ogm.drivers.bolt.request.BoltRequest - Request: MATCH (n:Person) OPTIONAL MATCH (n)-[r0]-() DELETE r0, n with params {} 2019-12-05 [http-nio-8080-exec-1] INFO org.neo4j.ogm.drivers.bolt.request.BoltRequest - Request: MATCH (n:Movie) OPTIONAL MATCH (n)-[r0]-() DELETE r0, n with params {} 2019-12-05 [http-nio-8080-exec-1] ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Can not set java.lang.Long field com.iaudit.neo4j.domain.Person.id to com.iaudit.neo4j.domain.Person] with root cause java.lang.IllegalArgumentException: Can not set java.lang.Long field com.iaudit.neo4j.domain.Person.id to com.iaudit.neo4j.domain.Person at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58) at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36) at java.lang.reflect.Field.get(Field.java:393) at org.neo4j.ogm.metadata.FieldInfo.read(FieldInfo.java:373) at org.neo4j.ogm.metadata.FieldInfo.readProperty(FieldInfo.java:432) at org.neo4j.ogm.utils.EntityUtils.identity(EntityUtils.java:54) at org.neo4j.ogm.context.MappingContext.nativeId(MappingContext.java:475) at org.neo4j.ogm.context.EntityGraphMapper.getNodeBuilder(EntityGraphMapper.java:278) at org.neo4j.ogm.context.EntityGraphMapper.mapEntity(EntityGraphMapper.java:216) at org.neo4j.ogm.context.EntityGraphMapper.map(EntityGraphMapper.java:127) at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:80) at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:41) at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:451) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.data.neo4j.transaction.SharedSessionCreator$SharedSessionInvocationHandler.invoke(SharedSessionCreator.java:124) at com.sun.proxy.$Proxy72.save(Unknown Source) at org.springframework.data.neo4j.repository.support.SimpleNeo4jRepository.save(SimpleNeo4jRepository.java:72)

1 回复

让实体类去继承 image.png

回到顶部