Enterprise JavaBeans by Richard Monson-Haefel Following are the changes made in the 12/99 reprint: (8) In about the middle of the page, changed: "In a read application, we would..." To: "In a real application, we would " (28) Toward the bottom of the page, changed: "notify the bean class that it is about activated " to: "notify the bean instance that it is about to be activated " {59} The example read: public HypotheticalBean extends EntityBean { public int x; public double foo() { int i = this.getX( ); return this.bar( ); } public int getX(){ return x; } private double boo(int i){ double value = x * x; return x; } } It now reads: public HypotheticalBean extends EntityBean { public int x; public double foo() { int i = this.getX(); return this.boo(i); } public int getX(){ return x; } private double boo(int i){ double value = i * Math.PI; return value; } } {73} In the lowest boxin the figure, the method name now reads: "setDeckLevel()" instead of: "setName()". {84} The first line of second paragraph started with: The CabinBean class extends javax.ejb.EntityBean It now reads: The CabinBean class implements javax.ejb.EntityBean {104} The code line: sd.setSessionTimeout(60); Now reads: sd.setSessionTimeout(300); (114) The last line of code that read: java.rmi.NoSuchObjectException: Bean has been deleted was deleted. {119} The code line: TravelAgent agent = home.fin; Now reads: TravelAgent agent = home.create( ); {151} The following code block: if(result.next()){ name = result.getString("name"); capacity = result.getInt("capacity"); tonnage = result.getDouble("tonnage"); }else{ throw new ObjectNotFoundException( "Cannot find Ship with id = "+id); } Now reads (the new line is: this.id = id;): if(result.next()){ this.id = id; name = result.getString("name"); capacity = result.getInt("capacity"); tonnage = result.getDouble("tonnage"); }else{ throw new ObjectNotFoundException( "Cannot find Ship with id = "+id); } (170) Title read: Transitioning to the Ready state from the Pooled state via passivation now reads: Transitioning from the Ready state to the Pooled state via passivation (170) Title read: Transitioning to the Ready state from the Pooled state via removal It now reads: Transitioning from the Ready state to the Pooled state {179} The third line of code read: "import com.titan.travelagent.CreditCard; It has been deleted. (185) The following line of code was deleted: Statement stmt = null; {185} code fragment // concatenation of strings was required because of margin size in book. ps = con.prepareStatement ("INSERT INTO payment (customer_id, amount, type,"+ check_bar_code,check_number,credit_number, credit_exp_date)"+ VALUES (?,?,?,?,?,?,?)"); now reads (string concatenate fixed): ps = con.prepareStatement ("INSERT INTO payment (customer_id, amount, type,"+ "check_bar_code,check_number,credit_number,"+ "credit_exp_date) VALUES (?,?,?,?,?,?,?)"); {194 & 195} Replaced: package com.titan.travelagent; import java.rmi.RemoteException; import javax.ejb.FinderException; import com.titan.cruise.Cruise; import com.titan.customer.Customer; public interface TravelAgent extends javax.ejb.EJBObject { public void setCruiseID(int cruise) throws RemoteException; public int getCruiseID() throws RemoteException; public void setCabinID(int cabin) throws RemoteException; public int getCabinID() throws RemoteException; public Ticket bookPassage(CreditCard card, double price) throws RemoteException,IncompleteConversationalState, DoubleBookingException; } ------ with: -------- package com.titan.travelagent; import java.rmi.RemoteException; import javax.ejb.FinderException; import com.titan.cruise.Cruise; import com.titan.customer.Customer; import com.titan.processpayment.CreditCard; public interface TravelAgent extends javax.ejb.EJBObject { public void setCruiseID(int cruise) throws RemoteException, FinderException; public int getCruiseID() throws RemoteException; public void setCabinID(int cabin) throws RemoteException, FinderException; public int getCabinID() throws RemoteException; public int getCustomerID( ) throws RemoteException; public Ticket bookPassage(CreditCard card, double price) throws RemoteException,IncompleteConversationalState, DoubleBookingException; } (198) Changed: "double.valueOf(" to: "Double.valueOf(" {199} The source code read: "public int getCustomerID( )throws RemoteException{ if(cruise == null) throw new RemoteException(); return ((CustomerPK)customer.getPrimaryKey()).id; }" It now reads: "public int getCustomerID( )throws RemoteException{ if(customer == null) throw new RemoteException(); return ((CustomerPK)customer.getPrimaryKey()).id; }" (209) Near the bottom of the page, changed: "data, we wou212 ld use the Reservation bean." to: "data, we would use the Reservation bean." (209) Replaced: public interface TravelAgent extends javax.ejb.EJBObject { public void setCruiseID(int cruise) throws RemoteException; public int getCruiseID() throws RemoteException; --- with --- public interface TravelAgent extends javax.ejb.EJBObject { public void setCruiseID(int cruise) throws RemoteException, FinderException; public int getCruiseID() throws RemoteException; --- (210) Replaced: public void setCabinID(int cabin) throws RemoteException; public int getCabinID() throws RemoteException; public Ticket bookPassage(CreditCard card, double price) throws RemoteException,IncompleteConversationalState, DoubleBookingException; public String [] listAvailableCabins(int bedCount) throws RemoteException, IncompleteConversationalState; } --- with --- public void setCabinID(int cabin) throws RemoteException, FinderException; public int getCabinID() throws RemoteException; public int getCustomerID( ) throws RemoteException; public Ticket bookPassage(CreditCard card, double price) throws RemoteException,IncompleteConversationalState, DoubleBookingException; public String [] listAvailableCabins(int bedCount) throws RemoteException, IncompleteConversationalState; } {273} In the first paragraph, "When the ShipBean is persisted ..." now reads: "When the CabinBean is persisted ..." (280) In the footnote, changed: "Version 2.0 of EJB." to: "Version 1.1 of EJB." {312} line 7 was missing parenthesis. It read: "new AccountKey(targetID);" It now reads: "new AccountKey(targetID));