grails 中的 HQL 查询语法
我正在尝试获取具有多个“教育”的员工列表,每个“教育”都有一个“教育类型”,
因此员工有一个教育集合,每个教育都有一个有名称的类型。
def unchecked = educationTypes?.unchecked
String query = "FROM Employee e, IN (e.education) AS ed WHERE ed.type.name IN (:typeNames)";
def matches = Employee.executeQuery(query, [typeNames: unchecked]);
上面的查询给了我以下内容:
Stacktrace follows:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ed near line 1, column 39 [FROM Employee e, IN (e.education) AS ed WHERE ed.type.name IN (:typeNames)]
at $Proxy12.createQuery(Unknown Source)
所以我试图找出如何正确访问它。非常感谢任何帮助
I am trying to get a list of employees that have multiple "Education" which each have an "Education type"
so Employee has a collection of educations, which each have an type which have a name.
def unchecked = educationTypes?.unchecked
String query = "FROM Employee e, IN (e.education) AS ed WHERE ed.type.name IN (:typeNames)";
def matches = Employee.executeQuery(query, [typeNames: unchecked]);
The query above give me the following:
Stacktrace follows:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ed near line 1, column 39 [FROM Employee e, IN (e.education) AS ed WHERE ed.type.name IN (:typeNames)]
at $Proxy12.createQuery(Unknown Source)
So I am trying to figure out how to access this correctly. Much appreciation for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这样的事情:
Try something like this: