'Grails Domains: Get by Id not found
I have a Job (using Quartz)
A Service method which uses get (for a Domain class)
The problem is: sometimes (1 in a 1000) the domain's get(X) method returns null even if the row with id X exists.
If I use executeQuery or findByX the same problem happens.
Datasource has cache disabled.
Any suggestions?
Solution 1:[1]
We had the same problem with Quartz. The problem is that Quartz thread keep a connection that is not flushed. To the workaround is to use this in you job:
def session = sessionFactory.getCurrentSession()
session.flush()
session.clear()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | moskiteau |
