org.neo4j.ogm.exception.MappingException: Error mapping GraphModel to instance of ***.ProjectGraph

5062 단어 neo4j
실례화된 지식 스펙트럼 대상 프로젝트 그래프.java 프롬프트는 다음과 같이 오류 정보를 캡처합니다.
 Exception in thread "main" org.neo4j.ogm.exception.MappingException: Error mapping GraphModel to instance of .ProjectGraph
    at 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 .ProjectGraph
    at 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: .ProjectGraph.()
    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는 아무런 속성도 없는 구조 함수를 필요로 합니다. 프로젝트 Graph에 아무런 속성도 없는 구조 함수를 보완해야 합니다.
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{
	@GraphId
	private Long id;
	private String name;
	private String sid;
	
	@Relationship(type = "IndividualLicenseRelation")
	private List licenses;
	
	@Relationship(type = "IndividualResponRelation")
	private List respons;
	
	@Relationship(type = "IndividualUnitRelation")
	private List 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 getLicenses() {
		return licenses;
	}
	public void setLicenses(List licenses) {
		this.licenses = licenses;
	}
	public List getRespons() {
		return respons;
	}
	public void setRespons(List respons) {
		this.respons = respons;
	}
	public List getUnits() {
		return units;
	}
	public void setUnits(List 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{
	@GraphId
	private Long id;
	private String name;
	private String sid;
	
	@Relationship(type = "IndividualLicenseRelation")
	private List licenses;
	
	@Relationship(type = "IndividualResponRelation")
	private List respons;
	
	@Relationship(type = "IndividualUnitRelation")
	private List 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 getLicenses() {
		return licenses;
	}
	public void setLicenses(List licenses) {
		this.licenses = licenses;
	}
	public List getRespons() {
		return respons;
	}
	public void setRespons(List respons) {
		this.respons = respons;
	}
	public List getUnits() {
		return units;
	}
	public void setUnits(List units) {
		this.units = units;
	}
	//  
	public ProjectGraph() {
		super();
	}

	public ProjectGraph(String name, String sid) {
		this.name = name;
		this.sid = sid;
	}
	
}

좋은 웹페이지 즐겨찾기