-->
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.  [ 5 posts ] 
Author Message
 Post subject: Sun ONE 7 integration, transaction manager lookup solution
PostPosted: Thu Feb 05, 2004 6:00 am 
Newbie

Joined: Wed Jan 07, 2004 12:02 pm
Posts: 15
Location: Herne, Germany
We didn't succeed looking up the Sun ONE 7 transaction manager with the SunONETransactionManagerLookup class provided with hibernate 2.1.2.

However, here is an alternative solution we found. It was tested successfully in some simple examples using Oracle 9.x.

Code:
import java.util.Properties;

import javax.transaction.TransactionManager;

import net.sf.hibernate.HibernateException;
import net.sf.hibernate.transaction.TransactionManagerLookup;

public class SunOneTransactionManagerLookup implements TransactionManagerLookup
{
   /**
    * @see net.sf.hibernate.transaction.TransactionManagerLookup#getUserTransactionName()
    */
   public String getUserTransactionName()
   {
      return "UserTransaction";
   }
   
   /**
    * @see
    *   net.sf.hibernate.transaction.TransactionManagerLookup#
    *     getTransactionManager(java.util.Properties)
    */
   public TransactionManager getTransactionManager(Properties props)
      throws HibernateException
   {
      try
      {
         Class clazz = Class.forName("com.sun.jts.jta.TransactionManagerImpl");

         return
            (TransactionManager)
                  clazz.getMethod("getTransactionManagerImpl", null)
                       .invoke(null, null);
      }
      catch (Exception e)
      {
         throw new HibernateException(
               "Could not obtain Sun ONE transaction manager instance",
               e );
      }
   }
}


We used the following runtime parameters for Sun ONE 7:

Code:
-Dhibernate.jndi.url=iiop://<server-ip>:3700
-Dhibernate.jndi.class=com.sun.appserv.naming.S1ASCtxFactory


Dirk Fuhrmann,
Roger Wegner

http://www.ip-value.de


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 8:19 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Can SunOne players confirm this works fine ?

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Re: Sun ONE 7 integration, transaction manager lookup soluti
PostPosted: Mon Feb 16, 2004 3:35 pm 
Beginner
Beginner

Joined: Thu Dec 11, 2003 11:59 am
Posts: 24
I finally found it! You have to use the magical "Switch" class.

I have tested this and it works like a charm. Commits, rollbacks, the works. I'm going to add this to JIRA.

Code:
/**
* TransactionManager lookup strategy for Sun ONE Application Server 7
* @author Patrick Bradley
*/
import net.sf.hibernate.transaction.TransactionManagerLookup;
mport javax.transaction.TransactionManager;
import java.util.Properties;
import com.sun.enterprise.Switch;

public class SunOneTransactionManager implements TransactionManagerLookup {
  public TransactionManager getTransactionManager(Properties properties) {
    return Switch.getSwitch().getTransactionManager();
  }

  public String getUserTransactionName() {
    return "UserTransaction";
  }
}


Top
 Profile  
 
 Post subject: TransactionManagerLookup for Sun 8.1 Application Server
PostPosted: Tue Mar 06, 2007 6:32 am 
Beginner
Beginner

Joined: Mon Aug 23, 2004 12:44 am
Posts: 25
Is there an implementation that supports Sun 8.1 Application Server ?
If not, will the SunOne implementation do the job ?

Regards,
EDH


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 06, 2007 11:12 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
it does the job.

_________________
Emmanuel


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