The most important thing to remember is that warnings are due to your compiler, not hibernate - you can tell your compiler to ignore unrealized generics. Using HQL, we query the data in a safe way, which, unfortunately, java has no way to check.
There are many ways to overcome the syntactic ugliness of casting hibernation, for example:
1) use @suppressWarnings where casting or
2) use the Collections.checkedList method to create a new list.
See also: How to avoid type safety warnings with Hibernate HQL results?
source share