【问题标题】:Spring Data JPA PropertyReferenceException?Spring Data JPA PropertyReferenceException?
【发布时间】:2015-04-28 11:47:59
【问题描述】:

我使用 Spring Data JPA 1.8.0.RELEASE

实体Attachment有一个名为relate_id的属性,

我在Repository中添加了一个方法findByRelate_id(String rid)

但我遇到了一个例外:

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property relate found for type Attachment!

我真的需要我的字段名称是relate_id,而不是更改为relateId,我不希望自己写@Query(...)

如何解决?

【问题讨论】:

    标签: spring-data-jpa


    【解决方案1】:

    尝试添加另一个 _ 来转义它,因为它是 Spring Data 中的保留字符。

    findByRelate__id(String rid)
    

    查看this similar post

    【讨论】:

      猜你喜欢
      • 2023-03-13
      • 2017-01-29
      • 1970-01-01
      • 1970-01-01
      • 2017-04-19
      • 2013-06-06
      • 2017-07-17
      • 1970-01-01
      • 2017-11-29
      相关资源
      最近更新 更多