package com.geostar.gfstack.operationcenter.log.common.hibernate;
import com.geostar.gfstack.operationcenter.common.page.Page;
import com.geostar.gfstack.operationcenter.common.util.DBType;
import com.geostar.gfstack.operationcenter.common.util.StringUtil;
import com.google.common.reflect.TypeToken;
import org.apache.commons.collections.CollectionUtils;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.SessionFactory;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public abstract class MergeDao<T, ID extends Serializable> extends BaseDao<T, ID> {
private Class<T> clazz;
......
/**
* 获取Model类型供hibernate实例化对象使用
*
* @return
*/
public Class<T> getModelClass() {
if (clazz == null) {
TypeToken tt = TypeToken.of(this.getClass());
TypeToken st = tt.getSupertype(MergeDao.class);
clazz = (Class<T>) ((ParameterizedType) st.getType()).getActualTypeArguments()[0];
}
return clazz;
}
......
}