To retrieve data from database using Hibernate, I use the following syntax :
Query query = session.createQuery("from User where name=? and password=?");
query.setString(0,user.getName());
query.setString(1,user.getPassword());
List list = query.list(); // Line 1
Line 1 shows warning: “List is a raw type. References to generic type List should be parameterized.”
Now, if I add generics using:
List<User> list = (List<User>) query.list();
This again gives warning: “Unchecked type conversion.”
How do I check the type of List of Users?
I am not sure but seems okay to me .
You might want to use