Grails:域类属性名与嵌入类属性名冲突
如何按姓名筛选人员?Grails:域类属性名与嵌入类属性名冲突,grails,grails-2.5,Grails,Grails 2.5,如何按姓名筛选人员? 当我在查询中使用name时(例如Person.countByNameIsNotNull()),则Person会被bornInCountry.name过滤 生成的sql带有loggingSql=true: class Person { String name Country bornInCountry static embedded = ['bornInCountry'] } class Country { String name }
当我在查询中使用name时(例如
Person.countByNameIsNotNull()
),则Person会被bornInCountry.name过滤
生成的sql带有loggingSql=true
:
class Person {
String name
Country bornInCountry
static embedded = ['bornInCountry']
}
class Country {
String name
}
代码取自grails版本:2.5.3这很奇怪,似乎是gorm中的一个bug。您能否为person域类创建另一个属性,如age,并查看生成的sql?如果这是真的,那么在grails github repo中打开一个问题。这是一个bug。如果名称不一样,一切都会正常工作。您使用的是哪个版本的grails?你能报告同样的问题吗。我使用的是2.5.3,但同样的事情发生在3.1.4。您报告过这个问题吗?
Hibernate:
select
count(*) as y0_
from
person this_
where
this_.born_in_country_name is not null