开发者

grails webflow select statement problem

i use webflow in a my grails application, i have 2 tables with relation ManyToMany in hibernate mode. this relation as u know, creates a table with 2 primary keys of the original tables, both be the primary key of the third table.

my tables are destination and destinationGroup.

i write a select statement with dynamic finders to have a list of destnation group that has specific destin开发者_如何学运维ation. i try these ways and no effect for any one: 1-

def DestinationInstance = Destination.get(params.destination)
   flow.DestinationGroupList  = DestinationGroup.executeQuery("select distinct d.name,d.description from DestinationGroup d where d.destinations = :p",[p:DestinationInstance])

2-

def DestinationInstance = Destination.get(params.destination)
flow.destinationGroupList = DestinationGroup.findAllWhere(Destinations:destinationInstance)

3-

def DestinationInstance = Destination.get(params.destination)
   flow.destinationGroupList = DestinationGroup.findAll("from DestinationGroup as d where  d.destinations =:p", [p:destinationInstance]

)

these 3 statement has no effect, if there is any why for solving this problem please till me about it. thanks


Have you tried a Criteria query?

def c = DestinationGroup.createCriteria()
flow.destinationGroupList = c.list{
         destinations{
             idEq(destinationInstance.id)
         }
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜