Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. Caused by: <openjpa-2.4.0-r422266:1674604 fatal general error> org.apache.openjpa.persistence.PersistenceException: Exhausted Resultset
  2.  
  3. @PersistenceContext
  4. protected EntityManager em;
  5.  
  6.  
  7. @Override
  8. @TransactionalRollback
  9. public void updateContractor(Coupons coupon) {
  10. cacheWorker(() -> {
  11. em.merge(coupon);
  12. return null;
  13. }, coupon, new String[]{String.valueOf(coupon.getId().getContractorId()), coupon.getId().getCouponId()});
  14. }
  15.  
  16.  
  17. public <T> T cacheWorker(Supplier<T> supplier, Object object, String[] keyLine) {
  18. if (useCache) {
  19. String key = ParseUtils.collectToKeyWithDot(CACHE_DAO_PREFIX + keyLine);
  20. T value = select(key);
  21. if (object == null && value == null) {//For first Select
  22. value = supplier.get();
  23. addCache(key, value);
  24. } else if (object == null && value != null) { //For every repeated Select
  25. return value;
  26. } else if (object.equals(value) && value != null) {// For INSERT/UPDATE, and DELETE (which doesn't handle here)
  27. return value;
  28. } else if (!object.equals(value) && value != null) {// For UPDATE, and DELETE (which doesn't handle here)
  29. update(supplier, object, key);
  30. value = getCache(key);
  31. } else if (!object.equals(value) && value == null) {//For INSERT, and DELETE (which doesn't handle here)
  32. insert(supplier, object, key);
  33. value = getCache(key);
  34. }
  35. return value;
  36. } else {
  37. return supplier.get();
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement