@Test public void testFindByModificationPriorEmptyAnonymousFalse() { final String uuid = UUID.randomUUID().toString(); final ShoppingCartState scs = shoppingCartStateService.getGenericDao().getEntityFactory().getByIface(ShoppingCartState.class); scs.setGuid(uuid); scs.setCustomerEmail("bob@doe.com"); scs.setEmpty(true); scs.setState("State".getBytes()); scs.setShopId(10L); shoppingCartStateService.create(scs); final Instant tenSecondsAfterCreation = Instant.now().plusSeconds(10L); final Instant tenSecondsBeforeCreation = tenSecondsAfterCreation.plusSeconds(-20L); getTxReadOnly().execute(status -> { List<ShoppingCartState> carts = shoppingCartStateService.findByCriteria( " where e.empty = ?2 AND e.customerEmail IS NULL AND (e.updatedTimestamp < ?1 OR e.updatedTimestamp IS NULL)", tenSecondsBeforeCreation, true ); assertNotNull(carts); assertTrue(carts.isEmpty()); return null; }); getTxReadOnly().execute(status -> { List<ShoppingCartState> carts = shoppingCartStateService.findByCriteria( " where e.empty = ?2 AND e.customerEmail IS NULL AND (e.updatedTimestamp < ?1 OR e.updatedTimestamp IS NULL)", tenSecondsAfterCreation, true ); assertNotNull(carts); assertTrue(carts.isEmpty()); return null; }); shoppingCartStateService.delete(shoppingCartStateService.findByGuid(uuid)); }
@Override public ShoppingCartState findByGuid(final String guid) { return shoppingCartStateDao.findSingleByNamedQuery("SHOPPINGCARTSTATE.BY.GUID", guid); }
ShoppingCartStateServiceImpl extends BaseGenericServiceImpl<ShoppingCartState> implements ShoppingCartStateService { @Override public ShoppingCartState findByGuid(final String guid) { return shoppingCartStateDao.findSingleByNamedQuery("SHOPPINGCARTSTATE.BY.GUID", guid); } }
ShoppingCartStateServiceImpl extends BaseGenericServiceImpl<ShoppingCartState> implements ShoppingCartStateService { @Override public ShoppingCartState findByGuid(final String guid) { return shoppingCartStateDao.findSingleByNamedQuery("SHOPPINGCARTSTATE.BY.GUID", guid); } ShoppingCartStateServiceImpl(final GenericDAO<ShoppingCartState, Long> shoppingCartStateDao); }
ShoppingCartStateServiceImpl extends BaseGenericServiceImpl<ShoppingCartState> implements ShoppingCartStateService { @Override public ShoppingCartState findByGuid(final String guid) { return shoppingCartStateDao.findSingleByNamedQuery("SHOPPINGCARTSTATE.BY.GUID", guid); } ShoppingCartStateServiceImpl(final GenericDAO<ShoppingCartState, Long> shoppingCartStateDao); @Override ShoppingCartState findByGuid(final String guid); @Override List<ShoppingCartState> findByCustomerEmail(final String email, final long shopId); @Override List<ShoppingCartState> findByOrdernum(final String ordernum); }
ShoppingCartStateServiceImpl extends BaseGenericServiceImpl<ShoppingCartState> implements ShoppingCartStateService { @Override public ShoppingCartState findByGuid(final String guid) { return shoppingCartStateDao.findSingleByNamedQuery("SHOPPINGCARTSTATE.BY.GUID", guid); } ShoppingCartStateServiceImpl(final GenericDAO<ShoppingCartState, Long> shoppingCartStateDao); @Override ShoppingCartState findByGuid(final String guid); @Override List<ShoppingCartState> findByCustomerEmail(final String email, final long shopId); @Override List<ShoppingCartState> findByOrdernum(final String ordernum);  }