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

com.googlecode.jpattern.orm.session.datasource.DataSourceSessionProvider Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.googlecode.jpattern.orm.session.datasource;

import java.sql.SQLException;

import javax.sql.DataSource;

import com.googlecode.jpattern.orm.IOrmClassToolMap;
import com.googlecode.jpattern.orm.mapper.DBTableMapBuilder;
import com.googlecode.jpattern.orm.mapper.ITableMap;
import com.googlecode.jpattern.orm.session.ISession;
import com.googlecode.jpattern.orm.session.ISessionProvider;

/**
 * 
 * @author Francesco Cina
 *
 * 21/mag/2011
 */
public class DataSourceSessionProvider implements ISessionProvider {

	private final DataSource dataSource;
	
	public DataSourceSessionProvider(DataSource dataSource) {
		this.dataSource = dataSource;
		
	}
	@Override
	public ISession getSession(IOrmClassToolMap ormClassToolMap) {
		return new DataSourceSession(dataSource, ormClassToolMap);
	}

	@Override
	public void updateTableMap(ITableMap tableMap, boolean enableDBScan) throws SQLException {
		new DBTableMapBuilder(dataSource, tableMap , enableDBScan).updateTableMap();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy