/** * For tags, we won't know the refcount till all the data is loaded. So we update the table at * postload. */ public void postLoad() { ThreadConnection c = ThreadConnection.getInstance(); try { // update id logger.fine("before updating socialEventID"); c.prepareStatement( "INSERT INTO ID_GEN " + "(GEN_KEY, GEN_VALUE) " + "VALUES ('SOCIAL_EVENT_ID', " + ScaleFactors.events + 1 + ")"); c.executeUpdate(); /* c.prepareStatement("update ID_GEN set GEN_VALUE = " + "(select count(*) +1 from SOCIALEVENT) " + "where GEN_KEY='SOCIAL_EVENT_ID'"); c.executeUpdate(); */ logger.fine("after updating socialEventID"); } catch (SQLException e) { logger.log(Level.SEVERE, e.getMessage(), e); // LoadController.increaseErrorCount(); } }
public void load() { ThreadConnection c = ThreadConnection.getInstance(); try { PreparedStatement s = c.prepareStatement(STATEMENT); for (int i = 0; i < fields.length; i++) if (fields[i] != null) s.setString(i + 1, fields[i]); else s.setNull(i + 1, Types.VARCHAR); s.setDate(10, createdTimestamp); for (int i = 0; i < ifields.length; i++) s.setInt(11 + i, ifields[i]); c.addBatch(); } catch (SQLException e) { logger.log(Level.SEVERE, e.getMessage(), e); } }