编写 Entity Bean类(Part2) //Part1 public String ejbCreate(String state Code, float tax eibStore throws CreateException 容器将数据从 entity if(state Code ==null bean中存储到数据库中之前,会 throw new CreateEXcepti调用bean类的 o Store方法 this state code= state Code 在此方法中可以对要存 this. taxRate taxRate 储的的数据进行一些预处理 return null public void ejbPostCreate(String state Code, float taxRate)3 public void ejbLoadot if(state Code!=null state Code. trimo public void ejbstore os public void ejbRemoveot public void unsetEntity Contextot public void setEntity Context(Entity Context contextt public void ejbActivateot ublic void ejbPassivate(仆 }编写Entity Bean类(Part 2) //Part1 public String ejbCreate(String stateCode, float taxRate) throws CreateException{ if(stateCode == null){ throw new CreateException("The State Code is required."); } this.stateCode = stateCode; this.taxRate = taxRate; return null; } public void ejbPostCreate(String stateCode, float taxRate){} public void ejbLoad(){ if(stateCode != null) stateCode.trim(); } public void ejbStore() {} public void ejbRemove() {} public void unsetEntityContext() {} public void setEntityContext(EntityContext context) {} public void ejbActivate() {} public void ejbPassivate() {} } ejbStore: 容器将数据从entity bean中存储到数据库中之前,会 调用bean类的ejbStore方法。 在此方法中可以对要存 储的的数据进行一些预处理