0

I am getting this exception and after a lot of R&D i am unable to resolve it.

Basically the error comes when it uses findAll() method located in hbnpojogen-persistence-1.4.4.jar

public abstract interface GenericDAO<T, PK extends Serializable>

  public abstract List<T> findAll();

This is the code that tried to use this method.

HibernateFactory.getDataDao().findAll();

1 Answer 1

1

You need to open a transaction before executing findAll(). See e.g. Spring's HibernateTransactionManager and @Transactional annotation.

Sign up to request clarification or add additional context in comments.

3 Comments

I added all such transactions but in vain. My controller that is calling HibernateFactory.getDataDao().findAll(); is not mentioned as bean in applicationcontext.xml file. May be this is the problem. How to resolve it?
I posted code in question here stackoverflow.com/questions/6571074/…
I was using @Transactionalbut it was not working. Actually I my class was not in the base package as defined in the applicationcontext.xml file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.