if (order != null && !order.equals("")){
sql += " order by " + order;
}
ConnectionHolder connectionHolder = null;
Adapter adapter = null;
String baseClassName = getBaseClassName(clasz);
if (baseClassName != null) {
connectionHolder = new ConnectionHolder(clasz);
adapter = adapters.get(baseClassName);
} else {
connectionHolder = new ConnectionHolder(ActiveRecordBase.class);
adapter = adapters.get(ActiveRecordBase.class.getCanonicalName());
}
try{
Connection conn = connectionHolder.getConnection();
DaoSupport dao = new DaoSupport(conn);
if (adapter != null){
if (limit > 0){
sql = adapter.getLimitString(sql, limit, offset);
}
if (adapter.supportsLimitOffset() == false){
return dao.select(clasz, sql, args, 0, offset);
}
else{
return dao.select(clasz, sql, args, 0, 0);
}