FileDocCategorySizeDatePackage
UIDGeneratorBean.javaAPI DocJBoss 4.2.11318Fri Jul 13 20:56:00 BST 2007xpetstore.util.uidgen.ejb

UIDGeneratorBean

public class UIDGeneratorBean extends Object
ejb.bean name="UIDGenerator" type="Stateless" view-type="local"
ejb.transaction type="Required"
ejb.ejb-ref ejb-name="Counter" view-type="local" ref-name="ejb/CounterLocal"

Fields Summary
private EntityManager
manager
Constructors Summary
Methods Summary
private CountergetCounter(java.lang.String name)

      Counter counter = null;
      try
      {
         counter = manager.find(Counter.class, name);
         if (counter == null)
         {
            counter = new Counter(name);
            manager.persist(counter);
         }
      } catch (Exception e)
      {
         e.printStackTrace();
         throw new EJBException(e);
      }

      return counter;
   
public intgetUniqueId(java.lang.String idPrefix)

ejb.interface-method

      return getCounter(idPrefix).nextValue();