I had to Google "uniqueResult Query Java" to find out that you were talking about Hibernate. We've actually got a whole forum dedicated to Hibernate and its cousins here. I'm going to move this post there, and I'm sure then you'll get an answer.
I haven't used Hibernate's Query objects yet, but from the JavaDocs I gather it's similar to the "getFirst(List)" method I wrote for our DAOs.
Convenience method to return a single instance that matches the query, or null if the query returns no results.
This is used when the query you are issuing is expected to return a single object/value.
For example, if you have defined and mapped a Person class with a unique "name" attribute, querying for a Person with a given name will always return zero or one result. In this case you don't want to have to get a List back and extract the first element from it. Query.uniqueResult() will do this for you.
Simply cast the result to the class for which you are querying, Person in this example.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com