Package org.uengine.util.dao

Source Code of org.uengine.util.dao.SpringConnectionFactory

package org.uengine.util.dao;


import java.sql.*;

import org.springframework.jdbc.datasource.ConnectionHolder;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.transaction.support.TransactionSynchronizationManager;

//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//import org.springframework.jdbc.datasource.DataSourceUtils;

/**
* @author Bo-Sang kim
*/

public class SpringConnectionFactory extends DefaultConnectionFactory {

  private static final long serialVersionUID = org.uengine.kernel.GlobalContext.SERIALIZATION_UID;

  DataSourceTransactionManager transactionManager;
  public void setTransactionManager(
      DataSourceTransactionManager transactionManager) {
    this.transactionManager = transactionManager;
 

  public Connection getConnection() throws Exception{
   
    ConnectionHolder connHolder = (ConnectionHolder) TransactionSynchronizationManager.getResource(transactionManager.getDataSource());   
    Connection conn = connHolder.getConnection()

    return conn;
  }
}
TOP

Related Classes of org.uengine.util.dao.SpringConnectionFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.