-->
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: Accessing multiple data stores using weblogic
PostPosted: Wed Sep 01, 2004 5:27 am 
Newbie

Joined: Fri Jul 16, 2004 2:02 am
Posts: 13
Hibernate version: 2.1.6

We have a requirement to create DAO to execute stored
procedures from multiple datasources in a single
transaction in WebLogic server. Is it possible? If so could
you please provide some example.

_________________
Kary


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 06, 2004 11:59 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Yes it is possible. Just use a transactional DS from WL and configure the TransactionManagers in Hibernate (see the ref doc)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 8:21 am 
Newbie

Joined: Fri Jul 16, 2004 2:02 am
Posts: 13
emmanuel wrote:
Yes it is possible. Just use a transactional DS from WL and configure the TransactionManagers in Hibernate (see the ref doc)

My requirement is two fold :
one is to achieve global transaction behaviour using weblogic app. server
second is to access multiple data stores using two different conenction pools deployed on weblogic.

I have used the following code :
property name="hibernate.connection.datasource" value=<Name of datasource>/>
<property name="hibernate.transaction.manager_lookup_class" value="net.sf.hibernate.transaction.WeblogicTransactionManagerLookup"/>
<property name="hibernate.transaction.factory_class" value="net.sf.hibernate.transaction.JTATransactionFactory"/>
<property name="jta.UserTransaction" value="javax/transaction/UserTransaction"/>

The first requirement gets fulfilled bt above code.
But for second it gives the following error :

Caused by: java.sql.SQLException: Connection has already been created in this tx context for pool named CvdbPool. Illegal attempt to create connection from another pool: TlvPool

Thanks in advance!

_________________
Kary


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 9:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
First, you realize you need to set up two seperate SessionFactorys to access two seperate DataSources, right? You only posted config for one, so just wanted to be sure.

Second, make sure you are using transacted DS in WebLogic. How this is done varies by version, so check the docs. Also, make sure you are using the XA versions of your jdbc drivers. WebLogic allows you to "emulate 2PC" for non-XA drivers in a datasource, but they (at least up through 6.1) only allowed one such datasource to participate in a given JTA transaction.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 1:47 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
steve wrote:
but they (at least up through 6.1) only allowed one such datasource to participate in a given JTA transaction.

Same for 7

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 10, 2004 12:22 am 
Newbie

Joined: Fri Jul 16, 2004 2:02 am
Posts: 13
Second, make sure you are using transacted DS in WebLogic. How this is done varies by version, so check the docs. Also, make sure you are using the XA versions of your jdbc drivers. WebLogic allows you to "emulate 2PC" for non-XA drivers in a datasource, but they (at least up through 6.1) only allowed one such datasource to participate in a given JTA transaction.[/quote]


Thanks a million! Steve!
I was using non XA driver with "emulate 2PC" on. I tried with XA driver and it works!
Thanks once again.....

_________________
Kary


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.