java - How to avoid type safety warnings in Hibernate HQL results?

For example I have such query:

Query q = sess.createQuery("from Cat cat");
List cats = q.list();

If I try to make something like this it shows the following warning

Type safety: The expression of type List needs unchecked conversion to conform to List<Cat>

List<Cat> cats = q.list();

Is there a way to avoid it?

This question and all comments follow the "Attribution Required."

All Answers

Answers Loading...
Leave a Reply
You must be logged in to post a answer.