我的代码如下所示
@Repository
public interface SaleRepository extends GraphRepository<Sale> {
@Query("MATCH (n:Sale) WHERE n.userId = {userId} RETURN n")
Iterable<Sale> getSaleByUserId(@Param("userId") String userId);
}
Sale.JAva
@NodeEntity
public class Sale extends Entity implements Serializable{
private Date createdDate;
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
}
SaleData.java
@RequestMapping(path = "/connect/{userId}", method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
public String SaleData(@PathVariable final String userId)
{
Sale saleObject = null;
Iterable<Sale> saleData = SaleRepository.getSaleByUserId(String.valueOf(userPairInfo.getUserId()));
if(saleData .iterator().hasNext())
{
saleObject= saleData .iterator().next();
}
return "{\"userId\":\""+saleObject.getCreatedDate()+"\"}"; // on service call this gives me above error
}
如果我调用该服务我会收到错误,
java.lang.NoSuchMethodError: com.project.graphdb.neoj.domain.Sale.getCreatedDate()Ljava/util/Date
它主要是因为sale.java文件告诉我还缺少什么?
请帮忙解决这个问题我是java和Neo4j的新手
答案 0 :(得分:0)
我认为您使用的是java.util.Date而不是java.sql.Date,或者您可能需要重新编译源代码。