Enterprise JavaBeans

Errata for Enterprise JavaBeans

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page xiii
2nd paragraph

it quickly become should be it quickly became

Anonymous   
Printed
Page 8
In PersonServer source

public int getAge() { return age; 02. } NOW READS: public int getAge() { return age; }

Anonymous    Nov 01, 2003
Printed
Page 10
First code sample

PersonServer person = new PersonServer("Richard", 36); NOW READS: PersonServer person = new PersonServer("Richard", 34);

Anonymous    Nov 01, 2003
Printed
Page 33
2nd paragraph, 4th line

should be setMessageDrivenContext() instead of setMessageDrivenBeanContext() p.47 just below middle of page, jndiContext.lookup("java:comp/env/ejb/ReservationHome"); should be: jndiContext.lookup("java:comp/env/ejb/ReservationHomeRemote");

Anonymous   
Printed
Page 40
Cabin EJB's local home code example

public interface CabinHomeLocal extends javax.ejb.EJBHome { NOW READS: public interface CabinHomeLocal extends javax.ejb.EJBLocalHome {

Anonymous    Nov 01, 2003
Printed
Page 49
Second paragraph

The onMessage() method is not defined in the MessageDrivenBean interface. It is defined in javax.jms.MessageListener.

Anonymous   
Printed
Page 65
last paragraph, first line

CHANGE: " processing of more then one " TO: "processing of more than one "

Anonymous   
Printed
Page 68
paragraph 3

The CabinBean defines three fields: a String of type name, an int of type deckLevel, and an Integer of type id . NOW READS: The CabinBean defines three fields: name of type String, deckLevel of type int, and id of type int.

Anonymous    Nov 01, 2003
Printed
Page 73
footnote

The footnote mentions "RemotePortableObject" instead of "PortableRemoteObject."

Anonymous   
Printed
Page 74
footnote marked with "cross"

The word "plugable" should be "pluggable."

Anonymous   
Printed
Page 75
5th paragraph

CabinHomeRemote cabinHome = (CabinHome)PortableRemoteObject.narrow(ref, CabinHomeRemote.class); should be changed to : CabinHomeRemote cabinHome = (CabinHomeRemote)PortableRemoteObject.narrow(ref, CabinHomeRemote.class);

Anonymous   
Printed
Page 77
2nd paragraph

CabinHomeRemote cabinHome = (CabinHome)PortableRemoteObject.narrow(ref, CabinHomeRemote.class); should be CabinHomeRemote cabinHome = (CabinHomeRemote)PortableRemoteObject.narrow(ref, CabinHomeRemote.class);

Anonymous   
Printed
Page 81
last line

<ejb-name>EmployeeService</ejb-name> NOW READS: <ejb-name>CabinEJB</ejb-name>

Anonymous    Nov 01, 2003
Printed
Page 90
code: ejbCreate method

returns null; should be return null;

Anonymous   
Printed
Page 90
source code for ejbPostCreate()

public void ejbPostCreate(Integer id){ } NOW READS: public void ejbPostCreate(Integer id){ // Not implemented. }

Anonymous    Nov 01, 2003
Printed
Page 93
end of 1st paragraph of section "EJB 2.0 and 1.1: The callback methods"; The text

"...it sets the name field." should read "...it sets the id field."

Anonymous   
Printed
Page 97
XML code segment

At the begining of the XML file: <ejb-jar> <enterprise-beans> ... <enterprise-beans> should be <ejb-jar> <enterprise-beans> ... </enterprise-beans>

Anonymous   
Printed
Page 98
4th paragraph

CHANGE " (Cabin.class, CabinHome.class, CabinBean.class, and CabinPK.class) " TO: " (CabinRemote.class, CabinHomeRemote.class, and CabinBean.class) "

Anonymous   
Printed
Page 99
The class names in the figure do not match the class names in the text.

remove CabinPK.class & CabinPK.java from figure change Cabin.class & Cabin.java to CabinRemote.class & CabinRemote.java in figure change CabinHome.class & CabinHome.java TO CabinHomeRemote.class and CabinHomeRemote.java

Anonymous   
Printed
Page 99
Figure 4-2

The "meta-inf" directory should be located under the "dev" directory, not the "cabin" directory.

Anonymous   
Printed
Page 103
3rd paragraph, the code segment

Object ref = jndiContext.lookup("CabinHome"); NOW READS: Object ref = jndiContext.lookup("CabinHomeRemote");

Anonymous    Nov 01, 2003
Printed
Page 103
3rd paragraph;

CabinHome home = (CabinHomeRemote) NOW READS: CabinHomeRemote home = (CabinHomeRemote)

Anonymous    Nov 01, 2003
Printed
Page 106
middle of page

The definition of "getInitialContext" is misformatted so that the body statements are flush with the method definition immediately above (i.e., the 3 lines that make up the body are not indented).

Anonymous   
Printed
Page 109
code example - next to last line on page

jndiContext = new InitialContext(); NOW READS: jndiContext = getInitialContext();

Anonymous    Nov 01, 2003
Printed
Page 110
listing;code example

jndiContext = new InitialContext(); NOW READS: jndiContext = getInitialContext();

Anonymous    Nov 01, 2003
Printed
Page 114
Next to last paragraph last sentence

You EJB server's deployment tool ... Should be Your EJB server's deployment tool ...

Anonymous   
Printed
Page 114
5th line of XML

"to the Cabin EJB" NOW READS: "to the TravelAgent EJB".

Anonymous    Nov 01, 2003
Printed
Page 114
last two lines

"jar cf cabin.jar" NOW READS: "jar cf travelagent.jar", in both command lines.

Anonymous    Nov 01, 2003
Printed
Page 115
code paragraph beginning

import com.titan.cabin.CabinHomeRemote import com.tian.cabin.CabinHomeRemote should be: import com.titan.travelagent.TravelAgentRemote; import com.titan.travelagent.TravelAgentHomeRemote;

Anonymous   
Printed
Page 118
4th paragraph

"JNDI allows the application client to view the EJB server as a set of directories, like directories in a common filesystem." should be changed to "JNDI allows the application client to view the EJB server as a set of directories, like directories in a common file system." NOTE: The point is "filesystem" should be "file system" (two words)

Anonymous   
Printed
Page 119
1st paragraph

"it's similar in concept to the root of a filesystem." should be changed to "it's similar in concept to the root of a file system." NOTE: The point is "filesystem" should be "file system" (two words)

Anonymous   
Printed
Page 121
first para

P. 120, para. 4 says: "To be compatible with Java RMI, the actual types used in the java.rimi.Remote interfaces must be primitives, String types, java.rmi.Remote types or serializable types. P. 121 para 1, which, if I understand correctly summarizes the previous 2 paragraphs, omits String types. AUTHOR: Here is how to fix this: (on page 120, paragraph 4) CHANGE: "be primitives, String types, java.rmi.Remote types, or serializable types. " TO: "be primitives, java.rmi.Remote types, or serializable types (including the String type). "

Anonymous   
Printed
Page 130
Code under the phrase "This application creates output like the

following:"; com.titan.cabin.CabinHomeRemote com.titan.cabin.CabinRemote com.titan.cabin.CabinPK false NOW READS: com.titan.cabin.CabinHomeRemote com.titan.cabin.CabinRemote java.lang.Integer false

Anonymous    Nov 01, 2003
Printed
Page 139
A little past half-way down the page

Integer pk_1 = new Integer(101) should be: Integer pk_1 = new Integer(100)

Anonymous   
Printed
Page 139
Last code fragment, 6th line

Shouldn't "Integer pk_1 = new Integer(101);" be "Integer pk_1 = new Integer(100);" as the remark is "Obtain cabin 100" in line 1? AUTHOR: CHANGE (page 139 code listing on lower half of page) Integer pk_1 = new Integer(101); TO: Integer pk_1 = new Integer(100);

Anonymous   
Printed
Page 140
2nd code segment

The code of setting jndiContext: javax.naming.Context ctx = new javax.naming.InitialContext() NOW READS: javax.naming.Context ctx = getInitialContext();

Anonymous    Nov 01, 2003
Printed
Page 143
4th paragraph

Line 7: "... rather then passed by reference". it should be: "... rather than passed by reference". At the end of the paragraph it says "passed by reference rather then copied" it should be "passed by reference rather than copied"

Anonymous   
Printed
Page 148
3rd paragraph, 1st line.

"there is no need for network comminations." should be: "there is no need for network communication."

Anonymous   
Printed
Page 158
last complete sentence on page

"Although the return type of the ejbCreate() method is the primary key,..." should be: "Although the return type of the ejbCreate() method is the primary key type,..."

Anonymous   
Printed
Page 166
creating new Integer in both for-loops of Client.java

The Client.java-program contains a typo when creating the primary key. The sentence (java-code) should be changed from "Integer primaryKey = new Integer(args[i]);" to "Integer primaryKey = new Integer(i);" in both for-loops. The java-code would try to insert a record in the DB with a key equal to the argument passed from the command-line, which will fail because the argument passed will be a String even if the letter "1" was passed. AUTHOR: How to fix this: The following line occurs twice in the code listin on page 166. "Integer primaryKey =new Integer(args [ i ]);" CHANGE IT TO (replace args[ i ] with i): "Integer primaryKey =new Integer( i );"

Anonymous   
Printed
Page 170
line 2

This sentence has an unnecessary open-quote (before 'remote'): "We make dependant values immutable so that "remote clients cannot change..." remove extra open quote before remote

Anonymous   
Printed
Page 171
Line 7

The word "easy" on line 7 should be "easily" in the sentence that begins on line 6 and reads - "For example, we could easy add relationship fields for Phone, CreditCard, and other entity beans to the Customer EJB.

Anonymous   
Printed
Page 174
last sentence of next-to-last paragraph

"...so a local interface cannot declared as a return type of a parameter of a remote interface." NOW READS: "...so a local interface cannot be declared as a return type of a parameter of a remote interface."

Anonymous    Nov 01, 2003
Printed
Page 175
(line in second code listing)

AddressHomeLocal addrHome = (AddressHomeLocal)cntx.lookup("AddressHomeLocal"); NOW READS: AddressHomeLocal addrHome = (AddressHomeLocal) cntx.lookup("java:comp/env/ejb/AddressHomeLocal");

Anonymous    Nov 01, 2003
Printed
Page 176
first paragraph, CustomerRemote example code

The setAddress(String street, String city, String state, String zip) method needs to throw RemoteException.

Anonymous   
Printed
Page 176
3rd line

public interface Customer extends javax.ejb.EJBObject { NOW READS: public interface CustomerRemote extends javax.ejb.EJBObject {

Anonymous    Nov 01, 2003
Printed
Page 177
First code listing

Object ref = jndiEnc.lookup("SalesHomeRemote"); NOW READS: InitialContext cntx = new InitialContext(); Object ref = cntx.lookup("java:comp/env/ejb/SalesHomeRemote");

Anonymous    Nov 01, 2003
Printed
Page 178
In code listing

AddressHomeLocal addrHome = (AddressHomeLocal)cntx.lookup ("AddressHomeLocal"); NOW READS: AddressHomeLocal addrHome = (AddressHomeLocal) cntx.lookup("java:comp/env/ejb/AddressHomeLocal");

Anonymous    Nov 01, 2003
Printed
Page 179
the client application code

CustomerHome home = (CustomerHomeRemote) javax.rmi.ProtableRemoteObject.narrow(obj, CustomerHomeRemote.class); NOW READS: CustomerHomeRemote home = (CustomerHomeRemote) javax.rmi.ProtableRemoteObject.narrow(obj, CustomerHomeRemote.class); and Customer customer = home.create(primaryKey); NOW READS: CustomerRemote customer = home.create(primaryKey);

Anonymous    Nov 01, 2003
Printed
Page 185
last sentence of second paragraph

In the last sentence of the 2nd paragraph, the word "separate" should be "separates"

Anonymous   
Printed
Page 187
2nd paragraph

The last sentence you mis-typed Address EJB as Address EBJ

Anonymous   
Printed
Page 190
code segment

first line of the code: public class CustomerBean implements javax.ejb.EntityBean{ should be public abstract class CustomerBean implements javax.ejb.EntityBean{ it lost the "abstract" modifier.

Anonymous   
Printed
Page 191
5th paragraph

"associated with its AddressHome field" NOW READS: "associated with its homeAddress field"

Anonymous    Nov 01, 2003
Printed
Page 194
code sample on bottom of page

The method "setCreditCard" should be renamed or commented to highlight the fact that it is a business method and not a persistence method even tho it has the same method name as the previously declared virtual method "setCreditCard". AUTHOR: MAKE THE FOLLOWING CHANGE: CHANGE (add the comment to last code listing on page 194): public abstract class CustomerBean implements javax.ejb.EntityBean { ... public void setCreditCard(Date exp, String numb, String name, String org) TO: public abstract class CustomerBean implements javax.ejb.EntityBean { ... // The setCreditCard() business method uses the setCreditCard() abstract accessor. public void setCreditCard(Date exp, String numb, String name, String org)

Anonymous   
Printed
Page 194
last paragraph

" on the Address EJB to point back " NOW READS: " on the CreditCard EJB to point back "

Anonymous    Nov 01, 2003
Printed
Page 195
first line of the code

Customer customer = card.getCustomer(); NOW READS: CustomerLocal customer = card.getCustomer();

Anonymous    Nov 01, 2003
Printed
Page 198
1st paragraph code block; Methods were missing abstract modifier.

public abstract class CustomerBean implements javax.ejb.EntityBean { ... // relationship fields public java.util.Collection getPhoneNumbers(); public void setPhoneNumbers(java.util.Collection phones); public AddressLocal getHomeAddress();() public void setHomeAddress(AddressLocal local); NOW READS: public abstract class CustomerBean implements javax.ejb.EntityBean { ... // relationship fields public abstract Collection getPhoneNumbers(); public abstract void setPhoneNumbers(Collection phones); public abstract AddressLocal getHomeAddress(); public abstract void setHomeAddress(AddressLocal local); ... Also, on pg 198, PhoneBean class should have had an abstract modifier (second code listing on page 198) public class PhoneBean implements javax.ejb.EntityBean { NOW READS: public abstract class PhoneBean implements javax.ejb.EntityBean {

Anonymous    Nov 01, 2003
Printed
Page 199
code at bottom of page

line of code: if(phone.getType() = typeToRemove) { SHould be: if(phone.getType() == typeToRemove) {

Anonymous   
Printed
Page 199
Last line of code on page

java.util.Iterator does not contain the method: remove(Object o) The removePhoneNumber(byte typeToRemove) method attempts to remove an object from the iterator using iterator.remove(phone); The line should read phoneNumbers.remove(phone); The code that is downloadable is correct. AUTHOR: MAKE THE FOLLOWING CHANGE (to last code listing on page 199) CHANGE: iterator.remove(phone); TO: iterator.remove();

Anonymous   
Printed
Page 199
code example at top of page

// relationship fields public java.util.Collection getPhoneNumbers(); public void setPhoneNumbers(java.util.Collection phones); NOW READS: // relationship fields public abstract java.util.Collection getPhoneNumbers(); public abstract void setPhoneNumbers(java.util.Collection phones);

Anonymous    Nov 01, 2003
Printed
Page 200

CHANGE figure 7-7 In addition to the arrow drawn from CustomerA to Phone1, Arrows should also be drawn from the CustomerA to Phone2 and Phone3.

Anonymous   
Printed
Page 200
code at top of page

line of code: if(phone.getType() = typeToUpdate) { Should be: if(phone.getType() == typeToUpdate) {

Anonymous   
Printed
Page 200
Figure 7-7

On pg 200, should the 2nd diagram indicate one or three arrows removed? See attached image (figure 7-7 MODIFIED) for change

Anonymous   
Printed
Page 200
code example at top of page

public java.util.Collection getPhoneNumbers(); public void setPhoneNumbers(java.util.Collection phones); NOW READS: public abstract java.util.Collection getPhoneNumbers(); public abstract void setPhoneNumbers(java.util.Collection phones);

Anonymous    Nov 01, 2003
Printed
Page 201
code example

public java.util.Collection getPhoneNumbers(); public void setPhoneNumbers(java.util.Collection phones); NOW READS: public abstract java.util.Collection getPhoneNumbers(); public abstract void setPhoneNumbers(java.util.Collection phones);

Anonymous    Nov 01, 2003
Printed
Page 207
2nd paragraph

" is postponed until the ejbPostCreate() method completes " NOW READS: " is postponed until the ejbCreate() method completes "

Anonymous    Nov 01, 2003
Printed
Page 213
Figure 7-15

reservationsB.saddALL(...) should be reservationsB.addALL(...) See figure 7-15 MODIFIED in attached.

Anonymous   
Printed
Page 215
3rd paragraph

Missing word in sentence: Many-to-many bidirectional relationships always require a link [table] in a normalized relational database.

Anonymous   
Printed
Page 216
last code segment on page

"ReservationHomeLocal = ... get local Reservation home" NOW READS: "ReservationHomeLocal resHome = ... get local Reservation home"

Anonymous    Nov 01, 2003
Printed
Page 232
The code listing AND the Second to last paragraph

public abstract String ejbSelectMostPopularCity() throws FinderException; NOW READS: public abstract String ejbSelectCity(AddressLocal addr) throws FinderException; (2nd to last paragraph) "Select methods can return the values of CMP fields.The ejbSelectMostPopularCit y() method,for example,returns a single String value,the name of the city refer enced by the most Address EJBs." NOW READS: "Select methods can return the values of CMP fields. The ejbSelectCity(AddressL ocal addr) method,for example,returns a single String value,the name of the cit y referenced by the Address EJB."

Anonymous    Nov 01, 2003
Printed
Page 234
1st paragraph

CHANGE: "The name given in each <method-name> must match one of the ejbSelect<METHOD-NAME> methods defined in the bean class" TO: "The name given in each <method-name> element must match one of the ejbSelect methods defined in the bean class"

Anonymous   
Printed
Page 236
(first paragraph at top of page)

" The AS operator is optional, but it is used in this book to help make the EJB QL statements more clear. " NOW READS: " The AS operator is optional (its assumed) and is used in many, but not all, of the examples in this chapter. "

Anonymous    Nov 01, 2003
Printed
Page 242
middle of the page

For example, the following find method, findByShip(), is declared in the Cruise bean's local interface: public interface CruiseLocal extends javax.ejb.EJBLocalObject { public Collection findByShip( ShipLocal Ship ) throws FinderException; } NOW READS: For example, the following find method, findByShip(), is declared in the Cruise bean's local home interface: public interface CruiseLocalHome extends javax.ejb.EJBLocalHome { public Collection findByShip( ShipLocal Ship ) throws FinderException; }

Anonymous    Nov 01, 2003
Printed
Page 245
<< original entry said page 247 >> Code sample for ReservationHomeLocal

public interface ReservationHomeLocal extends EJBLocalObject { NOW READS: public interface ReservationHomeLocal extends EJBLocalHome {

Anonymous    Nov 01, 2003
Printed
Page 247
Second sentence of the third paragraph

"...produces in an UNKNOWN result" should be "...produces an UNKNOWN result"

Anonymous   
Printed
Page 277
last sentence of third paragraph

" we create a primary key and return it to the container." NOW READS: " we return the primary key to the container."

Anonymous    Nov 01, 2003
Printed
Page 281
second code segment

public class ShipBean extends javax.ejb.EntityBean { NOW READS: public class ShipBean implements javax.ejb.EntityBean {

Anonymous    Nov 01, 2003
Printed
Page 289
First code block

If(this.name.equals(other.name) and NOW READS: If(this.name.equals(other.name) &&

Anonymous    Nov 01, 2003
Printed
Page 295
last paragraph on page

The sentence reading "... so assignment of relationships is postponed until ejbPostCreate() completes and the primary key become available." should read "...so assignment of relationships is postponed until ejbCreate() completes and the primary key becomes available."

Anonymous   
Printed
Page 297
1st paragraph

In our example, a new record is inserted into the CUSTOMER table. NOW READS: In our example, a new record is inserted into the SHIP table.

Anonymous    Nov 01, 2003
Printed
Page 302
1st code example

public interface CruiseHomeLocal extends javax.ejb.EJBLocalHome { public CruiseLocal create(String name, ShipLocal ship); public void setName(String name); public String getName(); public void setShip(ShipLocal ship); public ShipLocal getShip(); public double totalReservationRevenue(CruiseLocal cruise); } NOW READS: public interface CruiseHomeLocal extends javax.ejb.EJBLocalHome { public CruiseLocal create(String name, ShipLocal ship); public double totalReservationRevenue(CruiseLocal cruise); }

Anonymous    Nov 01, 2003
Printed
Page 302
code example; (second code listing)

public abstract class CruiseBean implements javax.ejb.EntityBean { public Integer ejbCreate(String name, ShipLocal ship) { setName(name); } ... public double ejbHomeTotalReservationRevenue(CruiseLocal cruise) { Set reservations = ejbSelectReservations(cruise); Iterator enum = set.iterator(); double total = 0; while(enum.hasNext()) { ReservationLocal res = (ReservationLocal)enum.next(); Total += res.getAmount(); } return total; } public abstract ejbSelectReservations(CruiseLocal cruise); ... } NOW READS: public abstract class CruiseBean implements javax.ejb.EntityBean { public Integer ejbCreate(String name, ShipLocal ship) { setName(name); } ... public double ejbHomeTotalReservationRevenue(CruiseLocal cruise) { Set reservations = ejbSelectReservations(cruise); Iterator enum = reservations.iterator(); double total = 0; while(enum.hasNext()) { ReservationLocal res = (ReservationLocal)enum.next(); total += res.getAmount(); } return total; } public abstract ejbSelectReservations(CruiseLocal cruise); ... }

Anonymous    Nov 01, 2003
Printed
Page 303-304
3rd Line

public class A_Bean extends EntityBean { public EntityContext context; public void someMethod() { B_Bean b = ... // Get a remote reference to B_Bean. EJBObject obj = context.getEJBObject(); A_Bean mySelf = (A_Bean)PortableRemoteObject.narrow(obj,A_Bean.class); b.aMethod( mySelf ); } ... } NOW READS: public class A_Bean extends EntityBean { public EntityContext context; public void someMethod() { B_BeanRemote b = ... // Get a remote reference to B_Bean. EJBObject obj = context.getEJBObject(); A_BeanRemote mySelf = (A_BeanRemote) PortableRemoteObject.narrow(obj,A_BeanRemote.class); b.aMethod( mySelf ); } ... } Pg. 555-Change to Index Entry for ejbSelectCity(AddressLocal addr) NOW READS: Entry for ejbSelectCity(AddressLocal addr), 232

Anonymous    Nov 01, 2003
Printed
Page 366
The first large paragraph under heading "TopicConnection and Topic Session"

The sentence "However, having more than one TopicSession object is frequently helpful; if you wish to produce and consume messages using multithreading, a different Session needs to be created by each thread accessing that thread" should end with the word "Topic" rather than "thread". AUTHOR: The reader is kind of right. I would add this to the confirmed errata with the following change: (366) CHANGE: " each thread accessing that thread." TO: " each thread."

Anonymous