timbonicus opened a new issue, #14614: URL: https://github.com/apache/grails-core/issues/14614
I'm attempting to use GORM's withStatelessSession and finding that either it doesn't work, or I'm completely misunderstanding the concept. The attached project has an integration test (StatelessSessionTest) that uses withStatelessSession to wrap a block of code. Within this block, there is an entity loaded into the PersistenceContext from outside the block, and a GORM finder returns this entity from the cache. AbstractDatastore.createStatelessSession simply delegates to createSession, and HibernateDatastore doesn't seem to override this anywhere in its inheritance tree. ### Task List - [x] Steps to reproduce provided - [x] Stacktrace (if present) provided - [x] Example that reproduces the problem uploaded - [x] Full description of the issue provided (see below) ### Steps to Reproduce 1. Run StatelessSessionTest, observe the failure 2. Uncomment the GORM finder, breakpoint at SessionImpl#601 3. The entity is returned from the PersistenceContext cache ### Expected Behaviour The entity should be loaded without using cached state. ### Actual Behaviour The entity is returned using cached state. ### Environment Information - **Operating System**: Windows 10 - **GORM Version:** 6.1.2 - **Grails Version (if using Grails):** 3.2.8 - **JDK Version:** 1.8.0_121 ### Example Application [test-stateless.zip](https://github.com/grails/grails-data-mapping/files/977667/test-stateless.zip) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
