alexkramer / grails-hibernate-filter

Hibernate Filters Support for Grails 3, Hibernate 5, and GORM 6
Apache License 2.0
4 stars 8 forks source link

Grails Console and Hibernate Filter Plugins #11

Open misterlion opened 5 years ago

misterlion commented 5 years ago

Hi guys!

I am using Grails version 3.3.6 in a project. I ended up installing the Console and Hibernate Filter plugins. But when I open the console page gives the following error:

No Session found for current thread. Stacktrace follows: org.hibernate.HibernateException: No Session found for current thread at org.grails.orm.hibernate.GrailsSessionContext.currentSession (GrailsSessionContext.java:117) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession (SessionFactoryImpl.java:688) at org.grails.plugin.hibernate.filter.HibernateFilterInterceptor.before (HibernateFilterInterceptor.groovy: 16)

I found that HibernateFilterInterceptor gives a matchAll () that intercepts all controllers. Is there any configuration that tells the plugin some exclusionary? I believe this might work

Thanks!

alexkramer commented 5 years ago

There is currently no configuration available that will accomplish that filtering. I can see how this could be an issue in cases such as yours.

If you haven't already I believe a valid interim solution would be for you to replace my interceptor bean with your own in resources.groovy that includes the filtering condition.