Query query = session.createQuery("FROM User WHERE name = :name"); query.setString("name", "John"); Listusers = query.list();
Query query = session.createQuery("FROM Product WHERE category = :category"); query.setString("category", "electronics"); ListIn this example, we set the value of the "category" parameter to "electronics" and retrieve a list of products in the "electronics" category. The package library for org.hibernate is hibernate-core.products = query.list();