Hibernate Books

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: AuditLog
PostPosted: Fri Sep 24, 2004 9:03 pm 
Regular
Regular

Joined: Thu Jul 01, 2004 12:13 am
Posts: 68
Location: San Diego, CA
I tried implementing the Audit Log you have at the end of Chapter 8. However, I'm wondering if you experienced an infinite loop when you flushed the session for AuditLog class on pp. 346? I am seeing that it goes back to the postFlush() method in the AuditLogInterceptor.

Thanks,
Lou


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 9:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
read the book section again - it is a different session!


Top
 Profile  
 
 Post subject: Also, some errata
PostPosted: Fri Sep 24, 2004 9:28 pm 
Regular
Regular

Joined: Thu Jul 01, 2004 12:13 am
Posts: 68
Location: San Diego, CA
Yeah, I see that. I should probably mention I am using Spring to get a new Session. It has an overloaded method to get a new Session as follows:

Code:
Session session = SessionFactoryUtils.getSession(getSessionFactory, true);


The true parameter forces a new session to be created. Considering that this seems to be the same as the example, I was wondering if you saw this behavior in the Hibernate version or was this just some code you whipped up to show the concept.

The only way I could prevent from going into an infinite loop is to have a separate sessionfactory that doesn't use my audit Log entityInterceptor. Weird huh? But that's something I can take up with the Spring guys.

Also, it looks like there's an error in the code on pp. 345. : setSession() and setUserId() aren't available on the "Interceptor" interface, so the initialization would have to be:

Code:
AuditLogInterceptor interceptor = new AuditLogInterceptor();


Lou


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2004 3:32 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Typo confirmed, will be fixed in reprint.

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.