-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: JPwH Errata: Page 88: entityManager.getDelegate()
PostPosted: Wed Aug 29, 2007 9:31 am 
Newbie

Joined: Wed Aug 29, 2007 9:20 am
Posts: 3
Page 88 of the Java Persistence with Hibernate book states the following code :

Code:
Session session = (Session) entityManager.getDelegate()

However, this throws a ClassCastException at runtime because the returned object is of type org.hibernate.ejb.EntityManagerImpl

I therefore think the code example should be changed to

Code:
Session session = ((HibernateEntityManager) entityManager.getDelegate()).getSession();

or

Code:
HibernateEntityManager hibernateEntityManager = (HibernateEntityManager) entityManager.getDelegate();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 29, 2007 10:20 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This means you are using a version of the software (or JBoss AS) that is years older than the current version.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 29, 2007 10:31 am 
Newbie

Joined: Wed Aug 29, 2007 9:20 am
Posts: 3
I'm using the latest versions of
- the JBoss EJB-3.0 Embeddable server (alpha 9)
- Hibernate 3.2.5
- Hibernate Annotations 3.3.0
- Hibernate EntityManager 3.3.1


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 29, 2007 5:49 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Quote:
the JBoss EJB-3.0 Embeddable server (alpha 9)


This has been superseded by "Embedded JBoss" (JBoss 5.0 based) half a year ago: http://wiki.jboss.org/wiki/Wiki.jsp?page=EmbeddedJBoss

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 30, 2007 2:39 am 
Newbie

Joined: Wed Aug 29, 2007 9:20 am
Posts: 3
Thx for pointing this out.
I was using the JBoss EJB-3.0 Embeddable server (alpha 9) because I followed the link mentioned on page 80 (http://jboss.org/products/ejb3) and on that webpage this is the latest version I could find.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.