Query query = em.createQuery("SELECT e FROM Employee e WHERE e.salary > ?1"); query.setParameter(1, 50000);
Query query = em.createQuery("SELECT e FROM Employee e WHERE e.name = :name"); query.setParameter("name", "John Smith");
Query query = em.createQuery("SELECT e FROM Employee e WHERE e.department IN :departments"); query.setParameter("departments", Arrays.asList("Sales", "Marketing"));In this example, the parameter named "departments" is set to a list containing "Sales" and "Marketing". Package library: javax.persistence.