@Transactional(readOnly = true) public UserEntity getWithOrders(int id) { return repository.getByIdWithInitializedOrders(id); }
public Collection<UserEntity> getAll() { return repository.findAll(); }
public void update(UserEntity user) { repository.save(user); }
@Transactional(readOnly = true) public UserEntity getByEmail(String email) throws NotFoundException { Objects.requireNonNull(email, "Email must not be empty"); return repository.getByEmail(email); }
public UserEntity get(int id) throws NotFoundException { return repository.getOne(id); }
public void delete(int id) throws NotFoundException { repository.delete(id); }
public UserEntity save(UserEntity user) { return repository.save(user); }
@Override public LoggedUser loadUserByUsername(String email) throws UsernameNotFoundException { UserEntity u = repository.getByEmail(email.toLowerCase()); if (u == null) throw new UsernameNotFoundException("User " + email + " is not found"); return new LoggedUser(u); }