class RegistrationUnitRepository {

	public void update(RegistrationUnit registrationUnit) {
		LOGGER.info(registrationUnit.toString());

		Location location = registrationUnit.getAddress();
		AuditDetails auditDetails = registrationUnit.getAuditDetails();
		/**
		 * @RegistrationUnit_and_Location_are_saved_into
		 * @SingleTable @with_No_address_column
		 */
		try {
			jdbcTemplate.update(registrationUnitQueryBuilder.getUpdateQuery(), new PreparedStatementSetter() {

				@Override
				public void setValues(PreparedStatement ps) throws SQLException {
					/**
					 * @Object_created_according_to_the
					 * @Registration_unit_table_structure
					 */
					ps.setString(1, registrationUnit.getName());
					ps.setBoolean(2, registrationUnit.getIsActive());
					ps.setLong(3, location.getLocality());
					ps.setLong(4, location.getZone());
					ps.setLong(5, location.getRevenueWard());
					ps.setLong(6, location.getBlock());
					ps.setLong(7, location.getStreet());
					ps.setLong(8, location.getElectionWard());
					ps.setString(9, location.getDoorNo());
					ps.setLong(10, location.getPinCode());
					ps.setBoolean(11, registrationUnit.getIsMainRegistrationUnit());
					ps.setString(12, auditDetails.getCreatedBy());
					ps.setString(13, auditDetails.getLastModifiedBy());
					ps.setLong(14, auditDetails.getCreatedTime());
					ps.setLong(15, auditDetails.getLastModifiedTime());
					ps.setLong(16, registrationUnit.getId());
					ps.setString(17, registrationUnit.getTenantId());
				}
			});
		} catch (DataAccessException e) {
			jdbcTemplate.execute("ROLLBACK");
			e.printStackTrace();
		}
	}

}