Reputation: 1921
I am very new to Java and Hibernate and after being taken from a Unix background to be handed a Java project with problems I need assistance please.
The project currently has Hibernate set up with criteria to search a database of document meta-data and currently assumes a "Unique Result", with this line of code;
doc = (DocumentDetails) criteria.uniqueResult();
Meaning, I think, it expects only one document's details as a result. But we now can have multiple possible documents' details returned and I need to place them into an ArrayList
to determine which one is the latest document.
Any assistance would be appreciated on how to do this. I apologise for me being forward but I need to solve this one quick.
Upvotes: 1
Views: 1703
Reputation: 637
ArrayList<DocumentDetails> doc = (ArrayList<DocumentDetails>) criteria.list();
Upvotes: 2
Reputation: 691625
List<DocumentDetails> result = criteria.list();
As simple as that. Hibernate is documented.
Upvotes: 4