Hi all,
I've been trying to create a criteria builder containing a belongsTo relation and have yet to succeed. Consider the following model:
Code:class Msg { ... static belongsTo = [user: User] ... } class User { ... Organisation organisation ... }
I'm trying to make the following query:
All I'm getting is the following errorCode:Msg.createCriteria.list() { ... user { eq("organisation", organisationInstance) } ... }
Code:ERROR errors.GrailsExceptionResolver - No signature of method: static User.call() is applicable for argument types: (MsgService$_findMessages_closure1_closure6) values: [MsgService$_findMessages_closure1_closure6@afcba8] Possible solutions: save(), wait(), any(), getAll(), save(java.lang.Boolean), save(java.util.Map)
I've tried to add different small additions to the criteria query like:
But still get the same problem.Code:join "user" fetchMode("user", org.hibernate.FetchMode.EAGER)
I even tried to add the following static mapping to the Msg class:
Still not working.Code:static mapping = { columns { user lazy: false } }
Is there a way to use criteria builder containing a belongsTo query at all?
Thanks for your help in advance.
Lucien


Reply With Quote
