All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.blazebit.persistence.impl.hibernate.Hibernate4SessionInvocationHandler Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package com.blazebit.persistence.impl.hibernate;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

import org.hibernate.engine.spi.SessionImplementor;


public class Hibernate4SessionInvocationHandler implements InvocationHandler {
    
    private final SessionImplementor delegate;
    private final Object transactionCoordinatorProxy;

    public Hibernate4SessionInvocationHandler(SessionImplementor delegate, Object transactionCoordinatorProxy) {
        this.delegate = delegate;
        this.transactionCoordinatorProxy = transactionCoordinatorProxy;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if ("getTransactionCoordinator".equals(method.getName())) {
            return transactionCoordinatorProxy;
        }
        
        return method.invoke(delegate, args);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy