On initialisation of the web app, I am trying to inject some static data from the DB into the bean.
<bean id="CustomDriven" class="java.util.ArrayList">
<constructor-arg>
<value>#{FormCodeHibernateDAO.findAll()}</value>
</constructor-arg>
</bean>
I get an error
6:48:07,977 INFO [main] [UpdateTimestampsCache] starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache
16:48:07,981 INFO [main] [StandardQueryCache] starting query cache at region: org.hibernate.cache.StandardQueryCache
16:48:09,016 DEBUG [main] [GenericDaoJpa] findAll()
16:48:09,017 DEBUG [main] [GenericDaoJpa] getting HIBERNATE session…
16:48:09,196 ERROR [main] [GenericDaoJpa] Error when finding all
org.hibernate.SessionException: Session is closed!
at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:72)
at org.hibernate.impl.SessionImpl.setFlushMode(SessionImpl.java:1433)
Any reason why I am getting this?
I figured the problem, my CustomDriven bean was talking to the DAO Impl directly.
I changed it to talk to the DAO using a service and the new configuration looks like
And the DataDriverService class is
And the ServiceImpl is
Where FormCodeDAO in interface that extends the GenericDAO implementation