@Override public Customer map(int index, ResultSet resultSet, StatementContext ctx) throws SQLException { Customer customer = new Customer(); customer.setId((UUID) resultSet.getObject("id")); customer.setSlug(resultSet.getString("slug")); customer.setEmail(resultSet.getString("email")); customer.setPhoneNumber(resultSet.getString("phone_number")); customer.setFirstName(resultSet.getString("first_name")); customer.setLastName(resultSet.getString("last_name")); customer.setCompany(resultSet.getString("company")); customer.setUserId((UUID) resultSet.getObject("agent_id")); return customer; } }
resultSet.findColumn("email"); Customer customer = new Customer(); customer.setId(order.getCustomerId()); customer.setSlug(resultSet.getString("customer_slug")); customer.setEmail(resultSet.getString("email"));
@Override public Customer create(@Valid Customer customer) throws EntityAlreadyExistsException, InvalidEntityException { if (this.exists(customer.getSlug())) { throw new EntityAlreadyExistsException(); } getObservationManager().notify(new EntityCreatingEvent(), customer); this.dao.begin(); UUID entityId = UUID.randomUUID(); customer.setId(entityId); if (getTenant() == null) { this.dao.createEntity(customer, CUSTOMER_TABLE_NAME); } else { this.dao.createEntity(customer, CUSTOMER_TABLE_NAME, getTenant()); } this.dao.create(customer); this.dao.commit(); getObservationManager().notify(new EntityCreatedEvent(), customer); return customer; }