hi all,

we had some problems recently with findByPrimaryKey hitting the database no
matter if the bean was already in cache (for all commit options). not sure
if this was a supposed behavior. it all boils down to:
private Object callFinderMethod(Method finderMethod, Object[] args,
EntityEnterpriseContext ctx) in BMPPersistenceManager. a quick fix that does
it for commit option A, but doesn't address B & C.

      if (finderMethod.getName().equals("findByPrimaryKey"))
      {
//       System.out.println("checking if entity is in cache...");
         if (con.getInstanceCache().isActive((ctx.getCacheKey()==null)?(new
CacheKey(args[0])):(ctx.getCacheKey())))
         {
//            System.out.println("it IS in cache,  returning...");
            return args[0]; // Object is active -> it exists -> no need to
call finder
         }
//       System.out.println("it is NOT in cache...");
      }

regards,
--andrius


Reply via email to