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

org.onetwo.common.db.builder.Querys Maven / Gradle / Ivy

package org.onetwo.common.db.builder;

import javax.sql.DataSource;

import org.onetwo.common.db.InnerBaseEntityManager;
import org.onetwo.common.db.builder.QueryBuilderImpl.SubQueryBuilder;
import org.onetwo.common.db.spi.BaseEntityManager;
import org.onetwo.dbm.utils.Dbms;

/****
 * alias for QueryBuilderFactory 
 * @author way
 *
 */
final public class Querys {

	public static  QueryBuilder from(BaseEntityManager baseEntityManager, Class entityClass){
		QueryBuilderImpl q = new QueryBuilderImpl<>(baseEntityManager==null?null:baseEntityManager.narrowAs(InnerBaseEntityManager.class), entityClass);
		return q;
	}

	public static  QueryBuilder  from(Class entityClass){
		return from(Dbms.obtainBaseEntityManager(), entityClass);
	}

	public static  QueryBuilder  from(DataSource dataSource, Class entityClass){
		return from(Dbms.obtainBaseEntityManager(dataSource), entityClass);
	}

	public static  SubQueryBuilder subQuery(){
		SubQueryBuilder q = new SubQueryBuilder();
		return q;
	}

	private Querys(){
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy