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.  [ 4 posts ] 
Author Message
 Post subject: Bug with caching when using an OpenSession overload
PostPosted: Tue May 09, 2006 6:23 am 
Newbie

Joined: Mon May 08, 2006 12:24 pm
Posts: 1
I'm using NHibernate version 1.0.2 and I've discovered a bug with 2nd level caching when creating a session with an existing database connection. When using the following overload:

Code:
ISession OpenSession( IDbConnection connection );


The txTimestamp is passed through as long.MinValue which then causes problems with inserting items into the cache.

The following will address this problem:

Code:
private ISession OpenSession( IDbConnection connection, bool autoClose, IInterceptor interceptor )
      {
         long timestamp = Timestamper.Next();
         return new SessionImpl( connection, this, autoClose, timestamp, interceptor );
      }


The creation of the timestamp was promoted to the private implementation and removed from the public overloads. Due to my limited understanding of NH internals, I need to know if this will cause any problems?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 1:40 pm 
Beginner
Beginner

Joined: Sat Apr 17, 2004 1:11 am
Posts: 36
Was this ever addressed? We manage our own connections and have run into the same issue. This keeps us from being able to use caching at all. I don't know if a JIRA was ever created for it - if it's fixed in 1.2A1 or what.

I think we'll probably have to use a custom build and fix this as it's a killer for us.

Thx,

benster


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 2:16 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This is not a bug. If you are managing your own connections, NHibernate disables the use of second-level cache for the session to be safe. You can implement your own connection provider to work around it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 2:23 pm 
Beginner
Beginner

Joined: Sat Apr 17, 2004 1:11 am
Posts: 36
Thx - I saw some traffic on the Developers list after posting this.

Unfortunately we can't do that because we are managing our own connections because of the need to use multiple connection strings depending on the type of session requested. There's no way through that interface to determine this. Currently we wrap NH completely and my session wrapper object knows its type and can request from our pooling an appropriate connection when it's connected.

benster


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.