grailswebflow选择语句问题
我在我的grails应用程序中使用webflow,在hibernate模式下,我有两个表与关系ManyToMany。正如你所知道的,这个关系创建了一个包含原始表的两个主键的表,这两个主键都是第三个表的主键 我的表是destination和destinationGroup 我使用动态查找器编写一个select语句,以获得具有特定目的地的目的地组列表。 我尝试了这些方法,但对任何人都没有效果: 1- 2- 3- ) 这3条声明无效,如果有任何解决问题的原因,请告诉我。grailswebflow选择语句问题,grails,Grails,我在我的grails应用程序中使用webflow,在hibernate模式下,我有两个表与关系ManyToMany。正如你所知道的,这个关系创建了一个包含原始表的两个主键的表,这两个主键都是第三个表的主键 我的表是destination和destinationGroup 我使用动态查找器编写一个select语句,以获得具有特定目的地的目的地组列表。 我尝试了这些方法,但对任何人都没有效果: 1- 2- 3- ) 这3条声明无效,如果有任何解决问题的原因,请告诉我。 谢谢您尝试过条件查询吗 def
谢谢您尝试过条件查询吗
def c = DestinationGroup.createCriteria()
flow.destinationGroupList = c.list{
destinations{
idEq(destinationInstance.id)
}
}
如果leebutts的答案对你有效,你应该点击他答案旁边的复选标记来接受它。
def DestinationInstance = Destination.get(params.destination)
flow.destinationGroupList = DestinationGroup.findAllWhere(Destinations:destinationInstance)
def DestinationInstance = Destination.get(params.destination)
flow.destinationGroupList = DestinationGroup.findAll("from DestinationGroup as d where d.destinations =:p", [p:destinationInstance]
def c = DestinationGroup.createCriteria()
flow.destinationGroupList = c.list{
destinations{
idEq(destinationInstance.id)
}
}