2

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?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
VMOrtega
  • 1,948
  • 3
  • 18
  • 22

1 Answers1

0

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()
moskiteau
  • 1,104
  • 11
  • 19