Package javax.persistence

Examples of javax.persistence.Cache.evict()


    Cache cache = emf.getCache();

    // Customer should be in the cache
    assertTrue(cache.contains(Customer34.class, customer.getId()));

    cache.evict(Customer34.class);

    // After clearing the cache Customer should not be in the cache
    assertFalse(cache.contains(Customer34.class, customer.getId()));
  }
View Full Code Here


          Class<?> associatedClazz = associated.getClass();
          Method idGetter = associatedClazz
              .getDeclaredMethod("getId");
          EntityManagerFactory emf = em.getEntityManagerFactory();
          Cache emfCache = emf.getCache();
          emfCache.evict(associated.getClass(),
              idGetter.invoke(associated));
        } catch (Exception e) {
          log.warn("Error", e);
        }
      }
View Full Code Here

          if (associated == null) {continue;}
          Class<?> associatedClazz = associated.getClass();
          Method idGetter = associatedClazz.getDeclaredMethod("getId");
          EntityManagerFactory emf = em.getEntityManagerFactory();
          Cache emfCache = emf.getCache();
          emfCache.evict(associated.getClass(), idGetter.invoke(associated));
        } catch (Exception e) {
          log.warn("Error", e);
        }
      }
     
View Full Code Here

          Class<?> associatedClazz = associated.getClass();
          Method idGetter = associatedClazz
              .getDeclaredMethod("getId");
          EntityManagerFactory emf = em.getEntityManagerFactory();
          Cache emfCache = emf.getCache();
          emfCache.evict(associated.getClass(),
              idGetter.invoke(associated));
        } catch (Exception e) {
          log.warn("Error", e);
        }
      }
View Full Code Here

          Class<?> associatedClazz = associated.getClass();
          Method idGetter = associatedClazz
              .getDeclaredMethod("getId");
          EntityManagerFactory emf = em.getEntityManagerFactory();
          Cache emfCache = emf.getCache();
          emfCache.evict(associated.getClass(),
              idGetter.invoke(associated));
        } catch (Exception e) {
          log.warn("Error", e);
        }
      }
View Full Code Here

  }
 
  @Override
  public AbstractComponent getComponentFromStore(String componentId) {
    Cache c = entityManagerFactory.getCache();
    c.evict(ComponentSpec.class, componentId);
   
    return getComponent(componentId);
  }
 
  @Override
View Full Code Here

    Cache c = entityManagerFactory.getCache();
    if (c.contains(ComponentSpec.class, componentId)) {
      EntityManager em = entityManagerFactory.createEntityManager();
      ComponentSpec cs = em.find(ComponentSpec.class, componentId);
      if (cs != null && cs.getObjVersion() < latestVersion) {
        c.evict(ComponentSpec.class, componentId);
      }
      em.close();
    }
  }
 
View Full Code Here

          Class<?> associatedClazz = associated.getClass();
          Method idGetter = associatedClazz
              .getDeclaredMethod("getId");
          EntityManagerFactory emf = em.getEntityManagerFactory();
          Cache emfCache = emf.getCache();
          emfCache.evict(associated.getClass(),
              idGetter.invoke(associated));
        } catch (Exception e) {
          log.warn("Error", e);
        }
      }
View Full Code Here

          Class<?> associatedClazz = associated.getClass();
          Method idGetter = associatedClazz
              .getDeclaredMethod("getId");
          EntityManagerFactory emf = em.getEntityManagerFactory();
          Cache emfCache = emf.getCache();
          emfCache.evict(associated.getClass(),
              idGetter.invoke(associated));
        } catch (Exception e) {
          log.warn("Error", e);
        }
      }
View Full Code Here

          Class<?> associatedClazz = associated.getClass();
          Method idGetter = associatedClazz
              .getDeclaredMethod("getId");
          EntityManagerFactory emf = em.getEntityManagerFactory();
          Cache emfCache = emf.getCache();
          emfCache.evict(associated.getClass(),
              idGetter.invoke(associated));
        } catch (Exception e) {
          log.warn("Error", e);
        }
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.