181920212223242526
public class AddressService implements RepositoryService<Address> { @Override public Address store(Address address) { AddressDAO repository = new AddressDAO(); return repository.save(address); }
262728293031323334
} @Override public void remove(Address address) { AddressDAO repository = new AddressDAO(); repository.delete(address); }
343536373839404142
} @Override public Collection<Address> getAll() { AddressDAO repository = new AddressDAO(); return repository.getAll(); }
4142434445464748
} @Override public Address getById(Serializable id) { AddressDAO repository = new AddressDAO(); return repository.get(id); }
4748495051525354
return repository.get(id); } public Collection<Address> getByCustomerId(Serializable id) { Customer customer = new CustomerService().getById(id); AddressDAO repository = new AddressDAO(); return repository.getByPerson(customer.getPerson()); }