final OBCriteria<InventoryCount> icObc = OBDal.getInstance().createCriteria(
InventoryCount.class);
icObc.setFirstResult(1);
icObc.setMaxResults(1);
icObc.addOrderBy("id", false);
final InventoryCount baseIc = (InventoryCount) DalUtil.copy(icObc.list().get(0), false);
final OBCriteria<InventoryCountLine> iclObc = OBDal.getInstance().createCriteria(
InventoryCountLine.class);
iclObc.setFirstResult(1);
iclObc.setMaxResults(1);
final InventoryCountLine baseLine = (InventoryCountLine) DalUtil.copy(iclObc.list().get(0),
false);
final long time = System.currentTimeMillis();
commitTransaction();
for (int i = 0; i < NO_HEADER; i++) {
final InventoryCount ic = (InventoryCount) DalUtil.copy(baseIc, false);
ic.setPosted("N");
ic.setProcessed(false);
ic.setName(NAME_PREFIX + "_" + i);
for (int j = 0; j < NO_LINE; j++) {
final InventoryCountLine icl = (InventoryCountLine) DalUtil.copy(baseLine, false);
icl.setPhysInventory(ic);
icl.setLineNo((long) j);
ic.getMaterialMgmtInventoryCountLineList().add(icl);
}
OBDal.getInstance().save(ic);
}
commitTransaction();
log.debug("Created " + NO_HEADER + " inventorycounts and " + (NO_HEADER * NO_LINE)