@Test public void saving_a_guest_sets_the_technical_id() { Guest guest = new Guest("jjjkl", "name", "email@foo.de"); guestService.saveGuest(guest); getEntityManager().flush(); assertThat(guest.getId()).isNotNull(); }
public void saveGuest(Guest guest) { LOGGER.info(() -> "Saving guest " + guest); if (isBlank(guest.getPublicId())) { guest.setPublicId(randomUUID().toString()); } this.em.persist(guest); guestEvents.fire(guest); }
GuestService { public void saveGuest(Guest guest) { LOGGER.info(() -> "Saving guest " + guest); if (isBlank(guest.getPublicId())) { guest.setPublicId(randomUUID().toString()); } this.em.persist(guest); guestEvents.fire(guest); } }
GuestService { public void saveGuest(Guest guest) { LOGGER.info(() -> "Saving guest " + guest); if (isBlank(guest.getPublicId())) { guest.setPublicId(randomUUID().toString()); } this.em.persist(guest); guestEvents.fire(guest); } GuestService(); @Inject  GuestService(@Background Event<Guest> guestEvents); }
GuestService { public void saveGuest(Guest guest) { LOGGER.info(() -> "Saving guest " + guest); if (isBlank(guest.getPublicId())) { guest.setPublicId(randomUUID().toString()); } this.em.persist(guest); guestEvents.fire(guest); } GuestService(); @Inject  GuestService(@Background Event<Guest> guestEvents); void setEntityManager(EntityManager em); void saveGuest(Guest guest); Guest findSingleGuestById(@PathParam("guestId") Long guestId); List<Guest> getAllGuests(); Optional<Guest> findById(@PathParam("guestId") Long guestId); Optional<Guest> updateGuestDetails(Guest guest); Optional<Guest> findByPublicId(String publicId); boolean deleteGuest(@NotNull String publicId); }
GuestService { public void saveGuest(Guest guest) { LOGGER.info(() -> "Saving guest " + guest); if (isBlank(guest.getPublicId())) { guest.setPublicId(randomUUID().toString()); } this.em.persist(guest); guestEvents.fire(guest); } GuestService(); @Inject  GuestService(@Background Event<Guest> guestEvents); void setEntityManager(EntityManager em); void saveGuest(Guest guest); Guest findSingleGuestById(@PathParam("guestId") Long guestId); List<Guest> getAllGuests(); Optional<Guest> findById(@PathParam("guestId") Long guestId); Optional<Guest> updateGuestDetails(Guest guest); Optional<Guest> findByPublicId(String publicId); boolean deleteGuest(@NotNull String publicId);  }