-->
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.  [ 6 posts ] 
Author Message
 Post subject: Application running both Hibernate 2 and 3
PostPosted: Thu Nov 02, 2006 4:16 am 
Newbie

Joined: Thu Nov 02, 2006 4:13 am
Posts: 7
Location: San Jose, CA
Hi friends,
Has anyone used both these versions together in a single application. I need to use Hibernate 3 from inside a Hibernate 2 installation - any clues/ints/pointers really appreciated.

Regards
Harish


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 02, 2006 9:54 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
hibernate3 has different path names. hibernate2 stuff is all reached via net.sf.hibernate.* and hibernate3 stuff is all reached via org.hibernate.*

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject: Using both 2 and 3 together - Hibernate.properties
PostPosted: Thu Nov 02, 2006 4:44 pm 
Newbie

Joined: Thu Nov 02, 2006 4:13 am
Posts: 7
Location: San Jose, CA
Hi Chris,

The problem arises when using hibernate 2 and 3 is to share the hibernate.properties file which contains :

hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup

Regards
Harish


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 02, 2006 4:53 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
you'll have to load up the config files manually via the Configuration class. There is a configure method where you can specify the prop/xml file to be loaded.

http://www.hibernate.org/hib_docs/v3/ap ... ation.html

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 03, 2006 4:12 am 
Newbie

Joined: Thu Nov 02, 2006 4:13 am
Posts: 7
Location: San Jose, CA
Thanks Chris that now works.


Top
 Profile  
 
 Post subject: Hibernate 2 and 3 run together - Null sessionFactory
PostPosted: Fri Nov 03, 2006 10:41 pm 
Newbie

Joined: Thu Nov 02, 2006 4:13 am
Posts: 7
Location: San Jose, CA
Hi ,
Can anyone help me with this?

Trying to execute a db transaction to another application using Hibernate 3 ORM objects from within a Hibernate 2 installation.
Have configured a hibernate.cfg.xml file to for the Hibernate 3 session initialization.
In the application the hibernate 3 session creation and invokation happens after a hibernate 2 session and mappings are already loaded by the server. But the application always reads from the hibernate.properties file meant for Hibernate 2 to retrieve the ConnectionProvider, even though the application loads the hibernate 3 properties correctly, which then throws a ClassCastException :

18:08:52,333 INFO [STDOUT] [18:08:52,333] [FATAL] org.hibernate.connection.ConnectionProviderFactory - Could not instantiate connection provider
java.lang.ClassCastException
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:73)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1859)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1152)

Regards
Harish


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