-->
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: using two same drivers but with 2 different versions...
PostPosted: Thu Aug 04, 2005 10:00 am 
Newbie

Joined: Thu Aug 04, 2005 9:54 am
Posts: 3
Hibernate version:3.05
Name and version of the database you are using:Oracle 7 and 9
Tomcat 5.5.9 or JBoss 4



Hello,
We have an application that should run with oracle 7 and oracle 9.
Because of driver compatibility, we need to use driver for oracle7 and the driver for oracle9 in the same time.
Just asking if it is possible...
Thanks in advance.
Alban.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 04, 2005 11:53 am 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
I haven't tried this specifically, but it seems like you could get it to work by using two SessionFactory objects. For instance, in your HibernateUtil class, you can have code similar to the following.

Code:
Configuration cfg = new Configuration().configure();

cfg.setProperty("hibernate.connection.user", "someuser");
cfg.setProperty("hibernate.connection.password", "somePassword");
cfg.setProperty("hibernate.connection.url", "someURL");
cfg.setProperty("hibernate.connection.driver_class", "driverForOracle7");
SessionFactory oracle7Factory = cfg.buildSessionFactory();


cfg.setProperty("hibernate.connection.user", "someuser");
cfg.setProperty("hibernate.connection.password", "somePassword");
cfg.setProperty("hibernate.connection.url", "someURL");
cfg.setProperty("hibernate.connection.driver_class", "driverForOracle9");
SessionFactory oracle9Factory = cfg.buildSessionFactory();



Then, of course, you'd have to add methods to the standard HibernateUtil so that you could get a reference to whichever SessionFactory you need at the time.


Top
 Profile  
 
 Post subject: ok but...
PostPosted: Fri Aug 05, 2005 3:18 am 
Newbie

Joined: Thu Aug 04, 2005 9:54 am
Posts: 3
The problem is that the 2 driver contains allmost thje classes because of version system. So the class loader will be lost:
eg. Oracle7 the driver name is oracle.jdbc.driver.OracleDriver
and the driver name for Oracle 9 is oracle.jdbc.driver.OracleDriver.
You see now the problem.
Is there a way in hibernate to manage this?
Do I have to provide two class loaders?
Thanks for your reply...
Alban.


Top
 Profile  
 
 Post subject: forgot two words
PostPosted: Fri Aug 05, 2005 3:20 am 
Newbie

Joined: Thu Aug 04, 2005 9:54 am
Posts: 3
The problem is that the 2 driver contains allmost the same classes because of version system. So the class loader will be lost:
eg. Oracle7 the driver name is oracle.jdbc.driver.OracleDriver
and the driver name for Oracle 9 is oracle.jdbc.driver.OracleDriver.
You see now the problem.
Is there a way in hibernate to manage this?
Do I have to provide two class loaders?
Thanks for your reply...
Alban.


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.