FileDocCategorySizeDatePackage
TxSessionBean.javaAPI DocJBoss 4.2.13547Fri Jul 13 20:53:36 BST 2007org.jboss.ejb3.test.asynchronous

TxSessionBean

public class TxSessionBean extends Object implements TxSessionRemote, TxSessionLocal
author
Kabir Khan
version
$Revision: 57207 $

Fields Summary
EntityManager
manager
javax.ejb.SessionContext
ctx
Constructors Summary
Methods Summary
public voidcleanAll()

      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 voidcreateFruit(java.lang.String name, boolean rollback)

      Fruit fruit = new Fruit(name);
      manager.persist(fruit);
      if (rollback)ctx.setRollbackOnly();
   
public voidcreateVeg(java.lang.String name, boolean rollback)

      Vegetable veg = new Vegetable(name);
      manager.persist(veg);
      if (rollback)ctx.setRollbackOnly();
   
public java.util.CollectiongetEntries()

      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;