繁体   English   中英

spring jpa 查询方法的同一个字段名中有两个连续的大写字母时无法定位该字段

[英]spring jpa not able to locate the field when there are two consecutive capital letter coming in the same field name of a query method

当方法名在同一个字段名中包含两个连续的大写字母时,spring-jpa无法在表中定位到同一个字段

示例查询方法:

1.findByTypeAnd AS iteNameOrTypeAnd ZS iteName

2.findBy AC olumn或BC olumn

以上查询方法说明

  1. (type AND a_site_name) 或 (type AND z_site_name)
  2. a_column 或 b_column

相同的查询方法在 spring 启动和 spring-data-jpa 的 2.1.7.RELEASE 中有效。 目前,我正在迁移到 2.2.5.RELEASE 并且我正面临这个问题。

例外:

Unable to locate Attribute with the the given name [ASiteName] on this ManagedType [com.example.h2demo.domain.Subscriber]

这已从 Spring 引导 2.1.8 更改为 2.1.9

根据 Java Beans 规范,aColumn 的 getter 和 setter 必须是:

public String getaColumn

public void setaColumn(String aColumn)

所以查询方法一定是:

findByaColumnOrbColumn

Read more about this in the JIRA of Spring Data JPA https://jira.spring.io/browse/DATACMNS-1589

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM