Query query = session.createQuery("FROM Student"); Liststudents = query.list();
Query query = session.createQuery("FROM Student WHERE age >= 18"); ListHere, "createQuery" method sends an SQL statement "FROM Student WHERE age >= 18" to the database and retrieves selected data from the "Student" table. The retrieved data is stored in a list of "Student" class objects named "adultStudents". Package library: org.hibernate.Session is a part of the Hibernate package library. The fully qualified name of this class is "org.hibernate.Session".adultStudents = query.list();