2 Replies Latest reply on Mar 2, 2015 10:51 AM by anistor

    Cannot execute query during same transaction as a put operation.

    matjosquig

      I have a code segment similar to the following:

      transactionMananger.begin();
      Value value = new Value();
      cache.put("key", value);
      queryFactory.from(Value.class).maxResults(numResults).orderBy("date", SortOrder.ASC)
        .orderBy("index", SortOrder.ASC).having("date").lte(System.currentTimeMillis()).build().list();
      transactionMananger.commit();
      transactionMananger.end();
      

       

      Whenever this gets executed, I get the following exception.

      java.lang.ClassCastException: my.project.Value cannot be cast to org.infinispan.objectfilter.ObjectFilter$FilterResult

        at org.infinispan.query.dsl.embedded.impl.EmbeddedQuery.list(EmbeddedQuery.java:106)

      I can't seem to figure out how it is even possible for this exception to occur in this situation (there is no way that it should be of type Value at that point).

      This works fine if this is done outside of the transaction or as two separate transactions.

       

      I am using 7.1.0.Final with the following configuration:

      ConfigurationBuilder()
                      .clustering().cacheMode(CacheMode.REPL_SYNC).sync()
                      .transaction().transactionMode(TransactionMode.TRANSACTIONAL).autoCommit(true)
                      .transactionManagerLookup(new GenericTransactionManagerLookup())
                      .indexing().disable()
                      .build()
      

       

       

      Exception occurs here: infinispan/EmbeddedQuery.java at master · infinispan/infinispan · GitHub