Package org.jinq.jpa.transform

Examples of org.jinq.jpa.transform.LambdaInfo


      return new JPAQueryComposer<>(this, (JPQLQuery<U>)cachedQuery.get(), lambdas);
   }
  
   public <U> JPAQueryComposer<U> applyTransformWithLambda(JPQLOneLambdaQueryTransform transform, Object lambda)
   {
      LambdaInfo lambdaInfo = lambdaAnalyzer.extractSurfaceInfo(lambda, lambdas.size(), hints.dieOnError);
      if (lambdaInfo == null) { translationFail(); return null; }
      Optional<JPQLQuery<?>> cachedQuery = hints.useCaching ?
            cachedQueries.findInCache(query, transform.getTransformationTypeCachingTag(), new String[] {lambdaInfo.getLambdaSourceString()}) : null;
      if (cachedQuery == null)
      {
         cachedQuery = Optional.empty();
         JPQLQuery<U> newQuery = null;
         try {
            LambdaAnalysis lambdaAnalysis = lambdaInfo.fullyAnalyze(metamodel, hints.lambdaClassLoader, hints.isObjectEqualsSafe, hints.dieOnError);
            if (lambdaAnalysis == null) { translationFail(); return null; }
            getConfig().checkLambdaSideEffects(lambdaAnalysis);
            newQuery = transform.apply(query, lambdaAnalysis, null);
         }
         catch (QueryTransformException e)
         {
            translationFail(e);
         }
         finally
         {
            // Always cache the resulting query, even if it is an error
            cachedQuery = Optional.ofNullable(newQuery);
            if (hints.useCaching)
               cachedQuery = cachedQueries.cacheQuery(query, transform.getTransformationTypeCachingTag(), new String[] {lambdaInfo.getLambdaSourceString()}, cachedQuery);
         }
      }
      if (!cachedQuery.isPresent()) { translationFail(); return null; }
      return new JPAQueryComposer<>(this, (JPQLQuery<U>)cachedQuery.get(), lambdas, lambdaInfo);
   }
View Full Code Here

TOP

Related Classes of org.jinq.jpa.transform.LambdaInfo

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.