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

com.scudata.common.DataSourceSessionFactory Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20240823
Show newest version
package com.scudata.common;

import javax.sql.DataSource;

import com.scudata.dm.Env;

public class DataSourceSessionFactory implements ISessionFactory{
	
	private DataSource ds;
	private int dbType = DBTypes.UNKNOWN;
	private DBInfo dbInfo;

	public DataSourceSessionFactory(DataSource ds, Integer type) {
		this.ds = ds;
		if(type != null) {
			this.dbType = type;
		}
		dbInfo = new DBInfo( dbType );
	}
	
	public DBSession getSession() throws Exception {
		return new DBSession(ds.getConnection(), dbInfo );
	}

	public static ISessionFactory create(String name, DataSource dataSource, int type) {
		ISessionFactory sf = new DataSourceSessionFactory(dataSource, type);
		Env.setDBSessionFactory( name, sf );
		return sf;
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy