hibernate - Is it possible to query like this? -


code

class member{          string name                   }      class group{       string name       static hasmany = [member: member] } 

//controller

def member = member.get(1)               // member object expected def group = group.findbymember(member)   //error 

question

it not possible find group this.... (since group , member in 1 many relationship)

is there other simple way?

solution here:

http://adhockery.blogspot.com/2009/06/querying-by-association-redux.html

solution here:

def group = group.withcriteria {     createalias("member", "m")     eq("m.id", 1) } 

source

http://adhockery.blogspot.com/2009/06/querying-by-association-redux.html


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -