Using Grails + PostgreSQL - How do i debug the GORM?

落爺英雄遲暮 提交于 2019-12-11 19:26:14

问题


I am having an issue with PostgreSQL, while using Grails/GORM. I want to be able to figure out what the query is that is running. It is failing asking about a field that I do not have in the class, and I can not find in the db either, so I am wondering how to debug this.

Here is my exception:

ERROR: column this_.level_version does not exist Position: 123. Stacktrace follows: org.postgresql.util.PSQLException: ERROR: column this_.level_version does not exist Position: 123 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) at grails.orm.PagedResultList.(PagedResultList.java:55) at at.TriviaController.list(script13759817432761717501241.groovy:15) at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:186) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at com.brandseye.cors.CorsFilter.doFilter(CorsFilter.java:69) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679)


回答1:


You can specify logSql=true in your Datasource.groovy. See docs.



来源:https://stackoverflow.com/questions/18133530/using-grails-postgresql-how-do-i-debug-the-gorm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!