Rob Fox
Rob Fox

Reputation: 5571

sessionFactory is null in Grails service

I have defined def sessionFactory in my class class UpdateService. However sessionFactory always remains null. (I am calling the service from a controller and a job)

I need to clear Hibernate second level query cache from that service. What could be the problem?

Upvotes: 1

Views: 954

Answers (1)

Burt Beckwith
Burt Beckwith

Reputation: 75681

Do you also use def updateService in the controller and job, or are you using new UpdateService()? You have to use dependency injection (i.e. def foo).

Upvotes: 3

Related Questions