neo4j spring 数据无法识别的字段 "meta"
neo4j spring data Unrecognized field "meta"
我开始使用 Neo4j 和 spring 数据。
我可以做一个数据库,但不能做一个集合。
当我尝试使用保存方法时发生此错误。好像是因为jackson没有识别出字段。我寻找解决方案,但没有任何效果。
有人可以帮我吗?
10:52:49.481 [http-nio-8080-exec-2] INFO o.s.d.n.config.Neo4jConfiguration - Initialising Neo4jSession
10:52:51.617 [http-nio-8080-exec-2] ERROR o.n.o.s.response.RowModelResponse - failed to parse: {"row":[1],"meta":[null]}]}
10:52:51.694 [http-nio-8080-exec-2] INFO o.s.d.n.config.Neo4jConfiguration - Intercepted exception
May 13, 2016 10:52:56 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [DispatcherServlet] in context with path [/ProjetoExemplo] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "meta" (class org.neo4j.ogm.session.result.RowModelResult), not marked as ignorable (one known property: "row"])
at [Source: {"row":[1],"meta":[null]}]}; line: 1, column: 20] (through reference chain: org.neo4j.ogm.session.result.RowModelResult["meta"])] with root cause
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "meta" (class org.neo4j.ogm.session.result.RowModelResult), not marked as ignorable (one known property: "row"])
at [Source: {"row":[1],"meta":[null]}]}; line: 1, column: 20] (through reference chain: org.neo4j.ogm.session.result.RowModelResult["meta"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51)
at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:731)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:915)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1292)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1270)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:247)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2146)
at org.neo4j.ogm.session.response.RowModelResponse.next(RowModelResponse.java:45)
at org.neo4j.ogm.session.response.SessionResponseHandler.updateObjects(SessionResponseHandler.java:93)
at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:69)
at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:43)
at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:386)
我的class:
@NodeEntity
@JsonIgnoreProperties(ignoreUnknown = true)
public class Teste {
@JsonProperty("id")
private Long id;
public Long getId() {
return id;
}
private String name;
public Teste(){
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Teste other = (Teste) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
我的电话:
Teste teste1 = new Teste();
teste1.setName("TESTE");
testeService.save(teste1);
您似乎在使用 Neo4j 3?如果是这样,您使用的 SDN 版本可能不兼容。
Neo4j 3.0 与这些兼容:
- SDN 4.2 的当前快照:4.2.0.BUILD-SNAPSHOT
- SDN 4.1.1: 4.1.1.RELEASE 与 neo4j-ogm 2.0.2
我开始使用 Neo4j 和 spring 数据。
我可以做一个数据库,但不能做一个集合。
当我尝试使用保存方法时发生此错误。好像是因为jackson没有识别出字段。我寻找解决方案,但没有任何效果。
有人可以帮我吗?
10:52:49.481 [http-nio-8080-exec-2] INFO o.s.d.n.config.Neo4jConfiguration - Initialising Neo4jSession
10:52:51.617 [http-nio-8080-exec-2] ERROR o.n.o.s.response.RowModelResponse - failed to parse: {"row":[1],"meta":[null]}]}
10:52:51.694 [http-nio-8080-exec-2] INFO o.s.d.n.config.Neo4jConfiguration - Intercepted exception
May 13, 2016 10:52:56 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [DispatcherServlet] in context with path [/ProjetoExemplo] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "meta" (class org.neo4j.ogm.session.result.RowModelResult), not marked as ignorable (one known property: "row"])
at [Source: {"row":[1],"meta":[null]}]}; line: 1, column: 20] (through reference chain: org.neo4j.ogm.session.result.RowModelResult["meta"])] with root cause
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "meta" (class org.neo4j.ogm.session.result.RowModelResult), not marked as ignorable (one known property: "row"])
at [Source: {"row":[1],"meta":[null]}]}; line: 1, column: 20] (through reference chain: org.neo4j.ogm.session.result.RowModelResult["meta"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51)
at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:731)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:915)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1292)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1270)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:247)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2146)
at org.neo4j.ogm.session.response.RowModelResponse.next(RowModelResponse.java:45)
at org.neo4j.ogm.session.response.SessionResponseHandler.updateObjects(SessionResponseHandler.java:93)
at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:69)
at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:43)
at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:386)
我的class:
@NodeEntity
@JsonIgnoreProperties(ignoreUnknown = true)
public class Teste {
@JsonProperty("id")
private Long id;
public Long getId() {
return id;
}
private String name;
public Teste(){
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Teste other = (Teste) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
我的电话:
Teste teste1 = new Teste();
teste1.setName("TESTE");
testeService.save(teste1);
您似乎在使用 Neo4j 3?如果是这样,您使用的 SDN 版本可能不兼容。 Neo4j 3.0 与这些兼容:
- SDN 4.2 的当前快照:4.2.0.BUILD-SNAPSHOT
- SDN 4.1.1: 4.1.1.RELEASE 与 neo4j-ogm 2.0.2