我们有一个 Grails 应用程序,我们已经维护了一年多。但最近我们开始收到类似的错误
org.hibernate.hql.ast.QuerySyntaxException: CareAlert is not mapped [from CareAlert p where p.code in (:code)]
at $Proxy24.createQuery(Unknown Source)
at com.deerwalk.FrontEndService.getAlertMessage(FrontEndService.groovy:492)
at com.deerwalk.FrontEndService$getAlertMessage.call(Unknown Source)
at com.deerwalk.MemberProfileService.getCareAlertData(MemberProfileService.groovy:81)
at com.deerwalk.MemberProfileService$getCareAlertData.call(Unknown Source)
at com.deerwalk.MemberSearchController$_closure6.doCall(MemberSearchController.groovy:891)
at com.deerwalk.MemberSearchController$_closure6.doCall(MemberSearchController.groovy)
at grails.plugin.springcache.web.GrailsFragmentCachingFilter.doFilter(GrailsFragmentCachingFilter.groovy:66)
at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:86)
at org.grails.plugin.resource.DevModeSanityFilter.doFilter(DevModeSanityFilter.groovy:44)
at com.planetj.servlet.filter.compression.CompressingFilter.doFilter(CompressingFilter.java:270)
at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:106)
at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:106)
at java.lang.Thread.run(Thread.java:662)
我们在我们甚至没有接触过的模块中遇到了这种错误。问题似乎来自我们进行 GORM 查询的地方
CareAlert.findAll("来自 CareAlert p where p.code in (:code)", [code:code])
(它不是特定于 CareAlert 域)似乎解决问题的方法是,如果我们
在查询之前CareAlert.get(1)
或CareAlert.findAll()
至少一次调用任何动态查找器,则该域的问题似乎消失了。所以现在我们只放了一堆像
CareAlert.get(1)
客户端.get(1)
在引导程序中。
有没有人遇到过类似的问题?