For example I have such query:
Query q = sess.createQuery("from Cat cat");
List cats = q.list();
如果我尝试制作类似这样的东西,它会显示以下警告:
Type safety: The expression of type List needs unchecked conversion to conform to List<Cat>
List<Cat> cats = q.list();
有没有避免它的方法?
sess.createQuery("from Cat cat", Cat.class);
。 - Dominik Mohr