So I'm making an application using Hibernate/JPA that - at some point - has to get a List of all questions from the database.
I'm using a genericized service and a genericized DAO class to do my database interaction.
The method that should return a List<Question> is:
I call the method using Question.class as a parameter. I get no exceptions and my code runs fine, except that it keeps returning an empty List. In my program, I use both HibernateUtil and JPA annotations to map my entities. Could this be where my problem lies? Everything else does fine, the program has a method for storing Question objects with relationships to Answer objects etc. it all works fine. Except that I cannot get all Question objects from the database using this method. The debugger shows that it goes to commit and doesn't do a rollback, so no runtimeException gets thrown.
If I should post more code, just let me know what more you need. I don't want to post everything and make the thread unnecessarily lengthy.
I already tried casting criteria.list() to (List<T>), the compiler doesn't mind, but neither works.
Oracle Certified Professional: Java SE 6 Programmer
Oracle Certified Expert: Java EE 6 Web Component Developer
Oracle Certified Expert: Java EE 6 Enterprise JavaBeans Developer