final Criteria crit = session.createCriteria(MyClass.class);
final List<MyClass> myClassList = crit.list();
results in this : Type safety: The expression of type List needs unchecked conversion to conform to List
Is their a method to remove the warning, as I get an error using this :
final List<MyClass> myClassList = Collections.checkedList(MyClass.class, crit.list());
Well, you can use:
@SuppressWarnings("unchecked")
before the declaration...
Note that this will only suppress the warning - it won't do anything to make the code safer. In this case, I'd personally be happy enough about this; I'd trust Hibernate to do the right thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With