Just Hibernate

Errata for Just Hibernate

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.


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



Version Location Description Submitted By Date Submitted
PDF Page 11
last pagraph (code block)

As for Hiberbnate 4.3.5, class BasicMovieManager at page 11 won't compile, since method buildServiceRegistry() doesn't exist anymore. Besides that, class ServiceRegistryBuilder is signaled as deprecated. A slight change can make the code compile and run ok: ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(config.getProperties()).build(); // .buildServiceRegistry(); Please notice these differences in Hibernate version 4.3. ref: http://docs.jboss.org/hibernate/orm/4.3/javadocs/org/hibernate/service/ServiceRegistryBuilder.html To eliminate the deprecated reference, it seems better to change that line to: ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build(); Please consider that in future versions of your book. Thank you.

José Fernando Tepedino  Jun 26, 2014 
PDF Page 29
3rd paragraph

"We initiate a transaction by invoking the session.beginTrasaction method," should be "We initiate a transaction by invoking the session.beginTransaction method,"

José Fernando Tepedino  Jun 26, 2014 
PDF Page 43
2nd paragaph

At the mapping definition: <list name="cars" cascade="all" table="CARS_LIST"> <key column="SHOWROOM_ID"/> <index column="CAR_INDEX"/> <one-to-many class="Car"/> </list> It only worked by replacing "CAR_INDEX" by "CAR_ID". Please consider if the use of the primary key (with an implicit index) would be adequate in this case, as it seems to simplify the configuration. Please notice that I'm using SQL Server 2012 Express for the tests.

José Fernando Tepedino  Jun 29, 2014 
PDF Page 46
5th paragraph

"The retrieveSets test method would fetch the persisted set from the database, as shown in this listing:" The "retrieveSets" method cited here is not defined anywhere else along the whole book.

José Fernando Tepedino  Jun 29, 2014 
PDF Page 47
last paragraph

the tag <map-key column="CUST_NAME" type="string" /> should be <map-key column="CAR_NAME" type="string" />

José Fernando Tepedino  Jun 29, 2014 
PDF Page 48
1st paragraph

"—SHOWROOM_ID and CUST_NAME—in addition to the name and color columns." should be "—SHOWROOM_ID and CAR_NAME—in addition to the name and color columns."

José Fernando Tepedino  Jun 29, 2014 
PDF Page 48
4th paragraph

"As expected, the following output would be printed to the console if we run the retrieveMaps method on the client:" The "retrieveMaps" method cited here is not defined anywhere else along the whole book.

José Fernando Tepedino  Jun 29, 2014 
PDF Page 55
1st line

Isn't the inverse reference missing at the @JoinTable annonation? I could only make it work by changing it to: @JoinTable (name="SHOWROOM_CAR_SET_ANN_JOINTABLE", joinColumns = @JoinColumn(name="SHOWROOM_ID"), inverseJoinColumns = @JoinColumn(name = "CAR_ID") )

José Fernando Tepedino  Jun 29, 2014 
PDF Page 64
Table 5-3

According to the example code at page 63, the output from Engine table should be: <table> <tr> <th>CAR_ID </th><th> SIZE</th><th>MAKE</th><th>MODEL</th> </tr> <tr> <td>1</td><td>1.6 V8 GAS</td><td> V8 Series </td><td>DTS</td> </tr> </table>

José Fernando Tepedino  Jun 29, 2014 
PDF Page 67
2nd paragraph

At Engine class, the annotation around the Car variable causes a Hibernate error: @OneToOne(mappedBy="car") (sic) private Car car = null; An error occurred with the cited annotation:Initial SessionFactory creation failed.org.hibernate.AnnotationException: Unknown mappedBy in: Engine.car, referenced property unknown: Car.car It worked after replacing it with: @OneToOne(mappedBy="engine") private Car car = null;

José Fernando Tepedino  Jun 30, 2014 
PDF Page 70
last code block

Hibernate complains about the line <many-to-one name="movie" column="MOVIE_ID" class="Movie"/> with this message: Initial SessionFactory creation failed.org.hibernate. MappingException: Repeated column in mapping for entity: Actor column: MOVIE_ID (should be mapped with insert="false" update="false") After googling a little, I noticed that It worked by using this configuration: <!-- The movie this actor belongs to --> <many-to-one name="movie" class="Movie" insert="false" update="false"> <column name="MOVIE_ID" /> </many-to-one> Could you please check and clarify this issue? I'm using Hibernate 4.3.5, Java 1.7, and SQL Server 2012 Express for testing. Thanks in advance!

José Fernando Tepedino  Jun 30, 2014