Øys*_*sen 4 java spring spring-data-jpa
以下用于在Spring 1.5.10.RELEASE中工作,但在Spring 2.0.7.RELEASE中不起作用,我不知道为什么:
实体
@Entity
@Table(name = "locations")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Location {
// ... unimportant stuff
@Column(name = "c_locations_id")
private String cLocationId;
// ... more unimportant stuff
}
Run Code Online (Sandbox Code Playgroud)
存储库(又名"问题")
@Repository
public interface LocationRepository extends JpaRepository<Location, Long>, JpaSpecificationExecutor<Location> {
Location findByCLocationId(String cLocationId);
List<Location> findAllByOrderByCLocationIdAsc();
}
Run Code Online (Sandbox Code Playgroud)
我在上面的代码的Spring 2.0.7.RELEASE下得到的错误是
java.lang.IllegalArgumentException:无法在此ManagedType上找到具有给定名称[CLocationId]的Attribute.
由于其他情况,我无法更改属性的名称,因此我尝试了存储库中方法的不同变体:
findBycLocationId - 找不到类型为Location的属性orderBycLocationIdAsc!findByClocationId - 找不到类型位置的属性clocationId!你是说'CLocationId','cLocationId'吗?findByCLocationId - 无法在此ManagedType上找到具有给定名称[CLocationId]的Attribute它想要什么?!我只是想升级框架......
| 归档时间: |
|
| 查看次数: |
88 次 |
| 最近记录: |