Grails - Hibernate 连接元素
我有一个旧数据库,其中有 Hibernate 连接:
<join table="events_sub_seasons"
optional="false">
<key column="event_id" unique="true"/>
<many-to-one name="subSeason"
column="sub_season_id"
not-null="true"/>
</join>
我转而使用 GORM 进行建模,但我不确定如何对此连接进行建模,并且在文档中没有看到任何内容。现在我有这样的,但它不起作用:
static mapping = {
subSeason joinTable: [name:'events_sub_seasons', optional:false, key:'event_id', column:'sub_season_id']
}
有什么想法吗? 亚季亚季;
I have a legacy database that has a Hibernate join in it:
<join table="events_sub_seasons"
optional="false">
<key column="event_id" unique="true"/>
<many-to-one name="subSeason"
column="sub_season_id"
not-null="true"/>
</join>
I moved over to using GORM for the modeling, and I am not sure how to model this join and didn't see anything in the documentation. Right now I have it like this, but it doesn't work:
static mapping = {
subSeason joinTable: [name:'events_sub_seasons', optional:false, key:'event_id', column:'sub_season_id']
}
Any ideas?
SubSeason subSeason;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
返回到 Hibernate XML,它工作正常,所以这不再是问题。
Went back to Hibernate XML where it is working correctly, so this is no longer an issue.