@Override public void setRecordId(final Long recordId) { super.setRecordId(recordId); // Invoked by the jDBI mapper when retrieving the record: while there is no account_record_id column, // populate the field manually for EntitySqlDaoWrapperInvocationHandler#populateCaches to populate the // ACCOUNT_RECORD_ID cache setAccountRecordId(recordId); }
@Override public EntityHistoryModelDao<M, E> map(final int index, final ResultSet r, final StatementContext ctx) throws SQLException { final UUID id = getUUID(r, "id"); final long targetRecordId = r.getLong("target_record_id"); final String changeType = r.getString("change_type"); final DateTime createdDate = getDateTime(r, "created_date"); // preserve history record id, as it is needed to reference it with audit log final long historyRecordId = r.getLong("history_record_id"); final M entityModelDao = entityMapper.map(index, r, ctx); // Hack -- remove the id as it is the history id, not the entity id ((EntityModelDaoBase) entityModelDao).setId(null); // Hack -- similarly, populate the right record_id ((EntityModelDaoBase) entityModelDao).setRecordId(targetRecordId); // Hack -- account is special if (entityModelDao.getAccountRecordId() == null) { ((EntityModelDaoBase) entityModelDao).setAccountRecordId(targetRecordId); } return new EntityHistoryModelDao(id, entityModelDao, targetRecordId, ChangeType.valueOf(changeType), historyRecordId, createdDate); } }
@Override public void setRecordId(final Long recordId) { super.setRecordId(recordId); // Invoked by the jDBI mapper when retrieving the record: while there is no account_record_id column, // populate the field manually for EntitySqlDaoWrapperInvocationHandler#populateCaches to populate the // ACCOUNT_RECORD_ID cache setAccountRecordId(recordId); }
@Override public EntityHistoryModelDao<M, E> map(final int index, final ResultSet r, final StatementContext ctx) throws SQLException { final UUID id = getUUID(r, "id"); final long targetRecordId = r.getLong("target_record_id"); final String changeType = r.getString("change_type"); final DateTime createdDate = getDateTime(r, "created_date"); // preserve history record id, as it is needed to reference it with audit log final long historyRecordId = r.getLong("history_record_id"); final M entityModelDao = entityMapper.map(index, r, ctx); // Hack -- remove the id as it is the history id, not the entity id ((EntityModelDaoBase) entityModelDao).setId(null); // Hack -- similarly, populate the right record_id ((EntityModelDaoBase) entityModelDao).setRecordId(targetRecordId); // Hack -- account is special if (entityModelDao.getAccountRecordId() == null) { ((EntityModelDaoBase) entityModelDao).setAccountRecordId(targetRecordId); } return new EntityHistoryModelDao(id, entityModelDao, targetRecordId, ChangeType.valueOf(changeType), historyRecordId, createdDate); } }