PetDAOBeanpublic class PetDAOBean extends Object implements PetDAO
Fields Summary |
---|
private EntityManager | manager |
Methods Summary |
---|
public void | createCat(java.lang.String name, double weight, int lives)
Cat cat = new Cat();
cat.setName(name);
cat.setWeight(weight);
cat.setHairball("#$@#%@");
manager.persist(cat);
| public void | createDog(java.lang.String name, double weight, int bones)
Dog dog = new Dog();
dog.setName(name);
dog.setWeight(weight);
dog.setTrick("Sit");
manager.persist(dog);
| public java.util.List | findByWeight(double weight)
return manager.createQuery("from Pet p where p.weight < :weight").setParameter("weight", weight).getResultList();
|
|