带下划线的变量在派生查询方法中创建编译错误(spring-数据)
Variables with underscores create compile error within derived query methods (spring-data)
带下划线的变量创建错误“描述资源路径位置类型
派生查询无效!未找到 属性 类型字符串的 _db!遍历路径:Trnsction.ddate。 ..."
我有 "spring-data-commons » 1.11.2.RELEASE" 并且在这个版本中,
问题似乎已解决 (https://jira.spring.io/browse/DATACMNS-569) 但在我的存储库 class 中,当我添加如下方法时,尽管我转义了下划线,但它仍然无法编译。
List<Trnsction> findByDdate__db(Date ddate__db);
我的变量名是ddate_db,类型是Date.
此 "problem" 未修复,可能也不会修复。
如 JIRA 票证中所述:
I think we're gonna change that to fixing the documentation rather
that adding that feature as it would just lead to ambiguities in
method names and very ugly method names in general. The general
recommendation is to stick to Java coding style, i.e. use camel case
for property names.
也在文档中:
As we treat underscore as a reserved character we stongly advise to
follow standard Java naming conventions (i.e. not using underscores in
property names but camel case instead).
所以你不应该在你的变量名中使用下划线。
带下划线的变量创建错误“描述资源路径位置类型 派生查询无效!未找到 属性 类型字符串的 _db!遍历路径:Trnsction.ddate。 ..."
我有 "spring-data-commons » 1.11.2.RELEASE" 并且在这个版本中, 问题似乎已解决 (https://jira.spring.io/browse/DATACMNS-569) 但在我的存储库 class 中,当我添加如下方法时,尽管我转义了下划线,但它仍然无法编译。
List<Trnsction> findByDdate__db(Date ddate__db);
我的变量名是ddate_db,类型是Date.
此 "problem" 未修复,可能也不会修复。
如 JIRA 票证中所述:
I think we're gonna change that to fixing the documentation rather that adding that feature as it would just lead to ambiguities in method names and very ugly method names in general. The general recommendation is to stick to Java coding style, i.e. use camel case for property names.
也在文档中:
As we treat underscore as a reserved character we stongly advise to follow standard Java naming conventions (i.e. not using underscores in property names but camel case instead).
所以你不应该在你的变量名中使用下划线。