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();
final OBCriteria<InventoryCount> icObc = OBDal.getInstance().createCriteria(
InventoryCount.class);
icObc.add(Expression.like("name", NAME_PREFIX + "%"));
int cnt = 0;
int cntLine = 0;
for (final InventoryCount ic : icObc.list()) {
cnt++;
final InventoryCountLine icl = (InventoryCountLine) DalUtil.copy(baseLine, false);
icl.setPhysInventory(ic);
icl.setLineNo((long) (ic.getMaterialMgmtInventoryCountLineList().size() + 1));
ic.getMaterialMgmtInventoryCountLineList().add(icl);
cntLine = ic.getMaterialMgmtInventoryCountLineList().size();
icl.setDescription("desc " + ic.getName());
final InventoryCountLine icl2 = ic.getMaterialMgmtInventoryCountLineList().get(0);
icl2.setQuantityOrderBook(new BigDecimal((icl2.getQuantityOrderBook() == null ? 0f : icl2
.getQuantityOrderBook().floatValue() + 1f)));
OBDal.getInstance().save(ic);
}
commitTransaction();
log.debug("Read " + cnt + " inventorycounts with each " + cntLine