1 11 12 package freeforums.util; 13 14 import java.rmi.RemoteException ; 15 import javax.ejb.*; 16 17 public class AutoNumberBean implements EntityBean { 18 19 transient private EntityContext context; 20 21 public Integer autoNumberValue; 22 public String referenceName; 23 24 public String ejbCreate(String referenceName) throws CreateException { 25 26 this.referenceName = referenceName; 27 this.autoNumberValue = new Integer (0); 28 return null; 29 30 } 31 32 public void ejbPostCreate(String referenceName) { } 33 34 public void setEntityContext(EntityContext context) { this.context = context; } 35 36 public void unsetEntityContext() { context = null; } 37 38 public void ejbActivate() { } 39 public void ejbPassivate() { } 40 public void ejbLoad() { } 41 public void ejbStore() { } 42 public void ejbRemove() { } 43 44 47 48 public Integer getAutoNumberValue() throws RemoteException { 49 50 Integer currentValue = autoNumberValue; 51 autoNumberValue = new Integer (currentValue.intValue()+1); 52 return currentValue; 53 54 } 55 56 } | Popular Tags |