Package org.apache.openjpa.kernel

Examples of org.apache.openjpa.kernel.PreparedQueryCache


        assertNotNull(getPreparedQueryCache() + ": " + getPreparedQueryCache().getMapView() +
                " does not contain " + id, cached);
    }
   
    void assertNotCached(String id) {
        PreparedQueryCache cache = getPreparedQueryCache();
        if (cache != null) {
            assertNull(cache.get(id));
        }
    }
View Full Code Here


     * Gets the prepared query cached by the given key.
     *
     * @return the cached PreparedQuery or null if none exists.
     */
    PreparedQuery getPreparedQuery(String id) {
        PreparedQueryCache cache = getPreparedQueryCache();
        return (cache == null) ? null : cache.get(id);
    }
View Full Code Here

     *
     * @return true if this invocation caused the query being registered in the
     * cache.
     */
    private boolean preExecute(Map params) {
        PreparedQueryCache cache = _em.getPreparedQueryCache();
        if (cache == null) {
            return false;
        }
        FetchConfiguration fetch = _query.getFetchConfiguration();
        if (fetch.getReadLockLevel() != 0) {
            if (cache.get(_id) != null) {
                ignorePreparedQuery();
            }
            return false;
        }
        Boolean registered = cache.register(_id, _query, fetch);
        boolean alreadyCached = (registered == null);
        String lang = _query.getLanguage();
        QueryStatistics<String> stats = cache.getStatistics();
        if (alreadyCached && LANG_PREPARED_SQL.equals(lang)) {
            PreparedQuery pq = _em.getPreparedQuery(_id);
            if (pq.isInitialized()) {
                try {
                    Map rep = pq.reparametrize(params, _em.getBroker());
View Full Code Here

     * @param result an opaque object representing execution result of a query
     *
     * @return true if the prepared query can be initialized.
     */
    private boolean postExecute(Object result) {
        PreparedQueryCache cache = _em.getPreparedQueryCache();
        if (cache == null) {
            return false;
        }
        return cache.initialize(_id, result) != null;
    }
View Full Code Here

   
    /**
     * Remove this query from PreparedQueryCache.
     */
    boolean invalidatePreparedQuery() {
        PreparedQueryCache cache = _em.getPreparedQueryCache();
        if (cache == null)
            return false;
        ignorePreparedQuery();
        return cache.invalidate(_id);
    }
View Full Code Here

     * Gets the prepared query cached by the given key.
     *
     * @return the cached PreparedQuery or null if none exists.
     */
    PreparedQuery getPreparedQuery(String id) {
        PreparedQueryCache cache = getPreparedQueryCache();
        return (cache == null) ? null : cache.get(id);
    }
View Full Code Here

   
    @Override
    public void initialize() {
       
        OpenJPAConfiguration conf = (OpenJPAConfiguration)getProvider().getConfiguration();
        PreparedQueryCache pqc = conf.getQuerySQLCacheInstance();
       
        if (pqc == null) {
            throw new UserException(_loc.get("prep-query-cache-not-found"));
        }
       
View Full Code Here

  public void testPreparedQueryCacheIsActiveByDefault() {
    assertNotNull(getPreparedQueryCache());
  }
 
  public void testPreparedQueryCacheIsPerUnitSingleton() {
    PreparedQueryCache c1 = getPreparedQueryCache();
    PreparedQueryCache c2 = getPreparedQueryCache();
    assertSame(c1, c2);
  }
View Full Code Here

    assertNotNull(getPreparedQueryCache() + ": " + getPreparedQueryCache().getMapView() +
        " does not contain " + id, cached);
  }
 
  void assertNotCached(String id) {
      PreparedQueryCache cache = getPreparedQueryCache();
    if (cache != null) {
      assertNull(cache.get(id));
    }
  }
View Full Code Here

     * Gets the prepared query cached by the given key.
     *
     * @return the cached PreparedQuery or null if none exists.
     */
    PreparedQuery getPreparedQuery(String id) {
        PreparedQueryCache cache = getPreparedQueryCache();
        return (cache == null) ? null : cache.get(id);
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.kernel.PreparedQueryCache

Copyright © 2018 www.massapicom. 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.