use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutDao method query.
public <T> List<T> query(Class<T> classOfT, Condition cnd, Pager pager) {
Pojo pojo = pojoMaker.makeQuery(holder.getEntity(classOfT)).append(Pojos.Items.cnd(cnd)).addParamsBy("*").setPager(pager).setAfter(_pojo_queryEntity);
expert.formatQuery(pojo);
_exec(pojo);
return pojo.getList(classOfT);
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutDao method fetch.
public <T> T fetch(Class<T> classOfT, long id) {
Entity<T> en = holder.getEntity(classOfT);
if (en.getIdField() == null)
throw new DaoException("Need @Id for " + classOfT);
Pojo pojo = pojoMaker.makeQuery(en).append(Pojos.Items.cndId(en, id)).addParamsBy(id).setAfter(_pojo_fetchEntity);
_exec(pojo);
return pojo.getObject(classOfT);
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class EntityOperator method addDeleteSelfOnly.
public Pojo addDeleteSelfOnly(String name) {
if (null == entity)
return null;
Pojo pojo = dao.pojoMaker.makeDelete(entity);
pojo.append(Pojos.Items.cndName(entity, name));
pojo.addParamsBy(name);
pojoList.add(pojo);
return pojo;
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class EntityOperator method addUpdate.
public Pojo addUpdate(final Entity<?> en, final Object obj) {
if (null == en)
return null;
Pojo pojo = dao.pojoMaker.makeUpdate(en, null).append(Pojos.Items.cndAuto(en, Lang.first(obj))).setOperatingObject(obj);
pojoList.add(pojo);
return pojo;
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class EntityOperator method addUpdate.
public Pojo addUpdate(Chain chain, Condition cnd) {
Pojo pojo = dao.pojoMaker.makePojo(SqlType.UPDATE);
pojo.setEntity(entity);
pojo.append(Pojos.Items.entityTableName());
pojo.append(Pojos.Items.updateFieldsBy(chain));
pojo.append(Pojos.Items.cnd(cnd));
pojoList.add(pojo);
return pojo;
}
Aggregations