Hi,
With grails 2.x the grails shell already seemed to have a hibernate session set up for the shell session:
One could do things like:
mdc MyDomainClass.get(1)
println mdc
straight away.
With grails 3.2.9 (running the shell using: gradle shell -q), doing the same gets me:
ERROR org.springframework.dao.DataAccessResourceFailureException:
Could not obtain current Hibernate Session; nested exception is org.hibernate.HibernateException: No Session found for current thread
Database access seems to be configured properly, as with hibernate trace logging on I can see it working during startup.
Also, this works:
MyDomainClass.withNewSession {
mdc = MyDomainClass.get(1)
println mdc
}
However, the session is closed when that block is exited.
Is there any way to get a hibernate session running that can be used for the whole shell session as it used to be in the past (2.x).
I used to find grails shell very useful in the past.
Cheers,
Derek