/** * update the values of model to database table * * @param model the object holds the values * @return the successful updated record(s) count */ @Override @Auditable public int update(UserLoginHistory model) { return this.sqlContext .update(USER_LOGIN_HISTORY) .set(USER_LOGIN_HISTORY.IP_ADDRESS, model.getIpAddress()) .set(USER_LOGIN_HISTORY.LOGIN_TIME, model.getLoginTime()) .set(USER_LOGIN_HISTORY.AGENT, model.getAgent()) .set(USER_LOGIN_HISTORY.ACCEPTED, model.getAccepted()) .set(USER_LOGIN_HISTORY.USER_ID, model.getUserId()) .set(USER_LOGIN_HISTORY.LAST_UPDATED_BY, model.getLastUpdatedBy()) .set(USER_LOGIN_HISTORY.LAST_UPDATE_TIME, model.getLastUpdateTime()) .set(USER_LOGIN_HISTORY.VERSION_NUMBER, model.getVersionNumber()) .where(USER_LOGIN_HISTORY.ID.eq(model.getId())) .execute(); }
/** * insert the model to database table * * @param model the object holds the values */ @Override @Auditable public void create(UserLoginHistory model) { Integer key = this.sqlContext .insertInto(USER_LOGIN_HISTORY) .columns( USER_LOGIN_HISTORY.IP_ADDRESS, USER_LOGIN_HISTORY.LOGIN_TIME, USER_LOGIN_HISTORY.AGENT, USER_LOGIN_HISTORY.ACCEPTED, USER_LOGIN_HISTORY.USER_ID, USER_LOGIN_HISTORY.CREATED_BY, USER_LOGIN_HISTORY.CREATION_TIME, USER_LOGIN_HISTORY.LAST_UPDATED_BY, USER_LOGIN_HISTORY.LAST_UPDATE_TIME, USER_LOGIN_HISTORY.VERSION_NUMBER) .values( model.getIpAddress(), model.getLoginTime(), model.getAgent(), model.getAccepted(), model.getUserId(), model.getCreatedBy(), model.getCreationTime(), model.getLastUpdatedBy(), model.getLastUpdateTime(), model.getVersionNumber()) .returning(USER_LOGIN_HISTORY.ID) .fetchOne() .getValue(USER_LOGIN_HISTORY.ID); model.setId(key); }