Methods Summary |
---|
public void | cleanAll()
Query vegQuery = manager.createQuery("SELECT v FROM Vegetable v");
List veg = vegQuery.getResultList();
for (Iterator it = veg.iterator() ; it.hasNext() ; )
{
manager.remove(it.next());
}
Query fruitQuery = manager.createQuery("SELECT f FROM Fruit f");
List fruit = fruitQuery.getResultList();
for (Iterator it = fruit.iterator() ; it.hasNext() ; )
{
manager.remove(it.next());
}
|
public void | createFruit(java.lang.String name, boolean rollback)
Fruit fruit = new Fruit(name);
manager.persist(fruit);
if (rollback)ctx.setRollbackOnly();
|
public void | createVeg(java.lang.String name, boolean rollback)
Vegetable veg = new Vegetable(name);
manager.persist(veg);
if (rollback)ctx.setRollbackOnly();
|
public java.util.Collection | getEntries()
Query vegQuery = manager.createQuery("SELECT v FROM Vegetable v");
List veg = vegQuery.getResultList();
Query fruitQuery = manager.createQuery("SELECT f FROM Fruit f");
List fruit = fruitQuery.getResultList();
ArrayList list = new ArrayList();
for (Iterator it = veg.iterator() ; it.hasNext() ; )
{
list.add(it.next().toString());
}
for (Iterator it = fruit.iterator() ; it.hasNext() ; )
{
list.add(it.next().toString());
}
return list;
|