It looks like you can be the first to test out my new SpringTransactionManager :-). It wraps our TransactionContextManager in a PlatformTransactionManager subclass. You need to give it 2 constructor args, the kernel name and the tcm object name. The normal values are in the comments in the class.

Aight... kick it down yo.


What does Hibernate need? Can it work off a spring tm or does it need something else?

I think it wants a special lookup class... I wrote one up tonight based on comments to the dev list a while ago... creating a proxy to the TransactionManager instance. I have yet to test it though.


If you can come up with some kind of spring app that ought to work and uses the spring tm I would be able to test and perhaps debug my code :-)

I might be able to come up with something simple... though right now first priority is to just get something... anything working inside of Geronimo so our SE dept. can test it.

Anyways, looks like spring needs a Geronimo version like:

http://www.springframework.org/docs/api/org/springframework/ transaction/jta/WebSphereTransactionManagerFactoryBean.html

I've yet to look at what this puppy does.

And Hibernate needs a Geronimo version of:

http://cvs.sourceforge.net/viewcvs.py/hibernate/Hibernate3/src/org/ hibernate/transaction/JOTMTransactionManagerLookup.java? rev=1.1&view=auto

This is what I wrote and will be testing out tomorrow.

<snip>
package com.solidusnetworks.utils.geronimo;

import java.util.Properties;

import javax.transaction.TransactionManager;
import javax.management.ObjectName;

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

import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelRegistry;

/**
* Provides lookup of the Geronimo (1.0) transaction manager.
*
* @version $Id$ $Date$
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
*/
public class GeronimoTransactionManagerLookup
    implements TransactionManagerLookup
{
public static final String TXM_GBEAN_NAME = "geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/ 1.0/ car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionMana ger"; public static final String USER_TXN_NAME = "java:comp/ UserTransaction";

public TransactionManager getTransactionManager(final Properties props) throws HibernateException {
                try {
            //
// FIXME: This is probably not work when Geronimo versions change... :-(
            //
            ObjectName TM_NAME = new ObjectName(TXM_GBEAN_NAME);
            Kernel kernel = KernelRegistry.getSingleKernel();
return (TransactionManager) kernel.getProxyManager ().createProxy(TM_NAME, TransactionManager.class);
                }
                catch (Exception e) {
throw new HibernateException("Failed to lookup Geronimo transaction manager", e);
                }
        }

        public String getUserTransactionName() {
                return USER_TXN_NAME;
        }
}
</snip>

--jason

Reply via email to