连接表上的 Grails Criteria 投影
我对 grails 标准构建器有疑问,我想对与父表示例具有一对多关系的表上的列进行投影:
Car.createCriteria() {
projections {
property('name')
property('wheels.name')// ????
}
join 'wheels'
//or wheels {} ???
}
或者是否存在类似的情况?我认为这是别名的基本问题
I have an issue with grails criteria builder, I want to do a projection on a column that is on a table that is in one-to-many relation to parent table example:
Car.createCriteria() {
projections {
property('name')
property('wheels.name')// ????
}
join 'wheels'
//or wheels {} ???
}
or something similar exist? I think it is basic propblem with aliases
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设有以下域类:
我还假设这是所需的输出:
在这种情况下,您将这样做:
在这种情况下,我更喜欢 HQL 查询:
I am assuming the following domain classes:
I also assume that this is the desired output:
In this case you would do this:
I would prefer a HQL query in this case:
只做怎么样:
或者我错过了什么?
what about doing only:
Or am I missing something?