All pastes #611598 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-07-10 00:22 UTC
rendered paste body
    public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
        StringBuffer sb = new StringBuffer();
        sb.append(target.getClass().getName()).append(".").append(method.getName());
        
        if (countMap.containsKey(sb.toString())) {
            Integer count = countMap.get(sb.toString());
            if (method.getName().equalsIgnoreCase("save") && count.intValue() > this.batchSize) {
                em.flush();
                //em.clear();
                countMap.put(sb.toString(), new Integer(0));
            }
            else
                countMap.put(sb.toString(), new Integer(count.intValue()+1));
        }
        else
            countMap.put(sb.toString(), new Integer(1));
    }