org.neo4j.ogm.exception.MappingException: Error mapping GraphModel to instance of ***.ProjectGraph
实例化知识图谱对象ProjectGraph.java 提示如下截图错误信息:
Exception in thread "main" org.neo4j.ogm.exception.MappingException: Error mapping GraphModel to instance of <package>.ProjectGraphat org.neo4j.ogm.context.GraphEntityMapper.mapEntities(GraphEntityMapper.java:145)at org.neo4j.ogm.context.GraphEntityMapper.map(GraphEntityMapper.java:117)at org.neo4j.ogm.context.GraphEntityMapper.map(GraphEntityMapper.java:81)at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.executeAndMap(ExecuteQueriesDelegate.java:111)at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:82)at org.neo4j.ogm.session.Neo4jSession.query(Neo4jSession.java:323)Caused by: org.neo4j.ogm.exception.MappingException: Unable to instantiate class <package>.ProjectGraphat org.neo4j.ogm.annotations.EntityFactory.instantiate(EntityFactory.java:137)at org.neo4j.ogm.annotations.EntityFactory.instantiateObjectFromTaxa(EntityFactory.java:110)at org.neo4j.ogm.annotations.EntityFactory.newObject(EntityFactory.java:61)at org.neo4j.ogm.context.GraphEntityMapper.mapNodes(GraphEntityMapper.java:156)at org.neo4j.ogm.context.GraphEntityMapper.mapEntities(GraphEntityMapper.java:142)... 7 more
Caused by: java.lang.NoSuchMethodException: <package>.ProjectGraph.<init>()at java.lang.Class.getConstructor0(Class.java:3082)at java.lang.Class.getDeclaredConstructor(Class.java:2178)at org.neo4j.ogm.annotations.EntityFactory.instantiate(EntityFactory.java:133)... 11 more
造成的原因:ProjectGraph.java 需要没有任何属性的构造函数,补全ProjectGraph 没有任何属性的构造函数。
ProjectGraph.java 错误代码:
import java.util.List;import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;/*** 单位工程图谱对象* **/
@NodeEntity
@SuppressWarnings("serial")
public class ProjectGraph implements java.io.Serializable{@GraphIdprivate Long id;private String name;private String sid;@Relationship(type = "IndividualLicenseRelation")private List<LicenseGraph> licenses;@Relationship(type = "IndividualResponRelation")private List<ResponGraph> respons;@Relationship(type = "IndividualUnitRelation")private List<UnitGraph> units;//set 和 get 方法public Long getId() {return id;}public void setId(Long id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSid() {return sid;}public void setSid(String sid) {this.sid = sid;}public List<LicenseGraph> getLicenses() {return licenses;}public void setLicenses(List<LicenseGraph> licenses) {this.licenses = licenses;}public List<ResponGraph> getRespons() {return respons;}public void setRespons(List<ResponGraph> respons) {this.respons = respons;}public List<UnitGraph> getUnits() {return units;}public void setUnits(List<UnitGraph> units) {this.units = units;}public ProjectGraph(String name, String sid) {this.name = name;this.sid = sid;}}
ProjectGraph.java 修正后的代码:
import java.util.List;import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;/*** 单位工程图谱对象* **/
@NodeEntity
@SuppressWarnings("serial")
public class ProjectGraph implements java.io.Serializable{@GraphIdprivate Long id;private String name;private String sid;@Relationship(type = "IndividualLicenseRelation")private List<LicenseGraph> licenses;@Relationship(type = "IndividualResponRelation")private List<ResponGraph> respons;@Relationship(type = "IndividualUnitRelation")private List<UnitGraph> units;//set 和 get 方法public Long getId() {return id;}public void setId(Long id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSid() {return sid;}public void setSid(String sid) {this.sid = sid;}public List<LicenseGraph> getLicenses() {return licenses;}public void setLicenses(List<LicenseGraph> licenses) {this.licenses = licenses;}public List<ResponGraph> getRespons() {return respons;}public void setRespons(List<ResponGraph> respons) {this.respons = respons;}public List<UnitGraph> getUnits() {return units;}public void setUnits(List<UnitGraph> units) {this.units = units;}// 构造函数public ProjectGraph() {super();}public ProjectGraph(String name, String sid) {this.name = name;this.sid = sid;}}
org.neo4j.ogm.exception.MappingException: Error mapping GraphModel to instance of ***.ProjectGraph相关推荐
- Could not load driver class org.neo4j.ogm.drivers.http.driver.HttpDriver(Neo4j连接用bolt还是http)
这里需要注意如果只是用了 spring-boot-starter-data-neo4j 的话,连接驱动默认使用的是bolt协议.bolt协议好像底层使用二进制操作,更高效.如果要是用http协议的话要 ...
- neo4j ogm Class com is not a valid entity class. Please check the entity mapping问题
目前使用Neo4j OGM库的人应该不多了,现在可以直接使用Spring Boot Data Neo4j 简称SDN. 但是使用OGM的时候遇到一个问题:neo4j :: Getting java.l ...
- Hbase Solr 二级索引 同步int数据报错com.ngdata.hbaseindexer.parse.ByteArrayValueMappers: Error mapping byte
二级索引实现方式:Hbase + Key-Value Store Indexer + Solr 同步int数据时提示异常 异常如下 2019-12-16 17:39:18,346 WARN com.n ...
- Neo4j OGM的配置问题
日志: Exception org.springframework.web.util.NestedServletException: Request processing failed; nested ...
- CAS (10) —— JBoss EAP 6.4下部署CAS时出现错误exception.message=Error decoding flow execution的解决办法...
CAS (10) -- JBoss EAP 6.4下部署CAS时出现错误exception.message=Error decoding flow execution的解决办法 jboss版本: jb ...
- 如何设计一门语言(六)——exception和error code
我一直以来对于exception的态度都是很明确的.首先exception是好的,否则就不会有绝大多数的语言都支持他了.其次,error code也没什么问题,只是需要一个前提--你的语言得跟Hask ...
- org.hibernate.exception.SQLGrammarException: Error calling Driver#connect
2019独角兽企业重金招聘Python工程师标准>>> 1.hibernate报错 org.hibernate.exception.SQLGrammarException: Erro ...
- Neo4J OGM与Quarkus
在下面的视频中,我演示了一个使用Neo4J数据库和Neo4J OGM的Quarkus应用程序示例. 看一下GitHub上的示例项目 . 我为咖啡豆创建了一个示例域,其中包含我们可以查询和匹配的某些风味 ...
- Exception和Error深入分析~~~
Exception和Error深入分析~~~ Exception 和 Error 都是继承了 Throwable 类,在 Java 中只有 Throwable 类型的实例才可以被抛出(throw)或者 ...
最新文章
- 解決yum [Errno -1] Metadata file does not match checksum
- python生成随机数方法_Python生成随机数的方法
- FFmpeg从入门到精通:SEI那些事
- fastxml 大于符号不转换_你可能不知道的MATLAB入门技巧#第二话
- 跟我一起学.NetCore之依赖注入作用域和对象释放
- WebStrom里设置angular提示,可以在html中提示ts文件的内容
- skyeye linux qt,ARM仿真器SkyEye的安装及使用
- 错误:未启用当前数据库的SQL Server Service Broker,因此查询通知不受支持。如果希望使用通知,请为此数据库启用 Service Broker。...
- [转]PostgreSQL源码结构
- bilibili 韩顺平Java后端学习路线
- 计算机硬盘容量的最小单位,计算机中存储数据的最小单位和存储容量的基本单位各是什么?...
- java算法竞赛入门经典_算法竞赛入门经典笔记(1-3章)
- 《人工智能:一种现代的方法》总结 第二章
- 视频转格式用什么工具?mp4格式转换器,好用的视频格式转换器
- 应用白名单:方法与挑战
- 公需科目2020快速学习_2021公需科目快速学习方法
- android蓝牙4.0控制器,DFRobot Bluno控制器 蓝牙4.0 开发板 Arduino 安卓 IOS开发平台
- git pull 是到工作区还是暂存区_我把git想简单了
- 采集程序 -【开源项目】
- 自动升降压5-40V多串超级电容充电芯片和解决方案