【发布时间】:2014-05-26 07:41:27
【问题描述】:
我是 Open JPA 的新手,我正在将我的应用程序数据库服务从以 Hibernate 作为供应商提供者的 JPA 迁移到以 OpenJPA 作为供应商提供者的 JPA。一切都很好,但我无法迁移我的存储库。我收到以下错误:
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property find found for
type com.entities.LevelPossibilityData
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:353)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:353)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:353)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:353)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:271)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:245)
at org.springframework.data.repository.query.parser.Part.<init>(Part.java:72)
这是我的实体:
package com.entities;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import java.lang.reflect.Field;
@Entity
@Table(name = "LEVEL_POSSIBILITY_DATA", schema = "DEV")
@NamedQueries({
@NamedQuery(name = "LevelPossibilityData.findAllPossibilityGenIds", query = "SELECT distinct possibilityData.levelPossibilityGenId FROM LevelPossibilityData possibilityData where possibilityData.userCode is not null and possibilityData.possibilityType=?1 order by possibilityData.levelPossibilityGenId asc")})
public class LevelPossibilityData implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@Column(name = "LEVEL_SEQ_ID")
private BigDecimal levelSeqId;
@Column(name = "LEVEL_USER_CODE")
private String userCode;
@Column(name = "LEVEL_USER_POSSIBILITY_TYPE")
private String possibilityType;
@Column(name = "LEVEL_POSSIBILITY_GENERATOR_ID")
private String levelPossibilityGenId;
}
和我的存储库:
package com.dao;
import java.io.Serializable;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.entities.LevelPossibilityData;
public interface LevelPossibilityDataRepository<ID extends Serializable> extends JpaRepository<LevelPossibilityData, Serializable> {
public List<LevelPossibilityData> findAllPossibilityGenIds(String possibilityType);
}
你能帮我纠正这个错误吗?
【问题讨论】:
-
你确定它在相同版本的 spring-data-jpa 下工作正常,但在 hibernate 下工作正常吗?我的意思是你没有改变任何映射吗?我问是因为这个错误似乎高于 JPA 实现问题......
-
嗨,Macias,是的,它在以前的实现中运行良好(JPA 与 Hibernate 作为供应商提供者)。
标签: jpa jpa-2.0 openjpa spring-data-jpa jpa-2.1