-->
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.  [ 2 posts ] 
Author Message
 Post subject: Session openSession(Connection connection) method usage
PostPosted: Wed Jun 28, 2006 2:18 am 
Newbie

Joined: Tue Feb 01, 2005 8:18 am
Posts: 8
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1

My question is related to SessionFactory's
Session openSession(Connection connection) method.
I have databases say DB1, DB2, DB3, ... DBn
These databases have same schema (these databases have same table structures ).
I am creating one SessionFactory and using
Session openSession(Connection connection) method to obtain the Session. The connection provided to the openSession method may be for DB1 or DB2 or DB3 or ... DBn.
I am able to fetch the records using above technique. I am doing only read operations and not any updates.
My question is, is this approach valid ? Or I have to create SessionFactory for each database.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 28, 2006 8:54 am 
Beginner
Beginner

Joined: Fri Apr 09, 2004 12:47 pm
Posts: 36
I don't see any problem with that approach until you try and use a second level cache. If you start using it, you'll have to check wheter it is attached to the sessionFactory (so that each database can be cached independently) or if it's shared, and in this case I do believe you'll have troubles with objects coming from different database but instances of the same class and with the same id...


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