use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class EntityOperator method addUpdateForIgnoreNull.
public List<Pojo> addUpdateForIgnoreNull(final Entity<?> en, final Object obj, final FieldMatcher fm) {
if (null == en)
return null;
final FieldMatcher newFM;
if (null == fm)
newFM = FieldMatcher.make(null, null, true);
else {
newFM = fm;
newFM.setIgnoreNull(true);
}
final List<Pojo> re = new ArrayList<Pojo>(Lang.length(obj));
Lang.each(obj, new Each<Object>() {
public void invoke(int i, Object ele, int length) throws ExitLoop, LoopException {
Pojo pojo = dao.pojoMaker.makeUpdate(en, ele).append(Pojos.Items.cndAuto(en, ele)).setOperatingObject(ele);
pojo.getContext().setFieldMatcher(newFM);
re.add(pojo);
}
});
pojoList.addAll(re);
return re;
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class EntityOperator method addDeleteSelfOnly.
public Pojo addDeleteSelfOnly() {
if (null == entity)
return null;
Pojo pojo = dao.pojoMaker.makeDelete(entity);
pojo.append(Pojos.Items.cndAuto(entity, myObj));
pojo.addParamsBy(myObj);
pojoList.add(pojo);
return pojo;
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class NutDao method each.
public <T> int each(Class<T> classOfT, Condition cnd, Pager pager, Each<T> callback) {
Pojo pojo = pojoMaker.makeQuery(holder.getEntity(classOfT)).append(Pojos.Items.cnd(cnd)).addParamsBy("*").setPager(pager).setAfter(_pojo_queryEntity);
expert.formatQuery(pojo);
pojo.setAfter(_pojo_eachEntity);
pojo.getContext().attr(Each.class.getName(), callback);
pojo.getContext().attr("dao-cache-skip", "true");
_exec(pojo);
return pojo.getInt();
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class DerbyJdbcExpert method fetchPojoId.
public Pojo fetchPojoId(Entity<?> en, MappingField idField) {
String autoSql = "select IDENTITY_VAL_LOCAL() as id from " + en.getTableName();
Pojo autoInfo = new SqlFieldMacro(idField, autoSql);
autoInfo.setEntity(en);
return autoInfo;
}
use of org.nutz.dao.sql.Pojo in project nutz by nutzam.
the class GBaseJdbcExpert method fetchPojoId.
public Pojo fetchPojoId(Entity<?> en, MappingField idField) {
String autoSql = "SELECT @@@@IDENTITY";
Pojo autoInfo = new SqlFieldMacro(idField, autoSql);
autoInfo.setEntity(en);
return autoInfo;
}
Aggregations