Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-13486

Programmatic mapping not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 13.0.16.Final, 14.0.11.Final
    • Indexing
    • None
    • Hide

      EmbeddedCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().jmx().build());{{ }}

      Properties properties = new Properties();

      properties.put("hibernate.search.mapping.configurer", "com.acme.MyMappingConfigurer");

      Configuration dcc = cacheManager.getDefaultCacheConfiguration();
      {{ ConfigurationBuilder b = new ConfigurationBuilder();}}
      {{ if (dcc != null)}}
      {{ b = b.read(dcc);}}

      b.indexing().enable().addIndexedEntity(InfinispanSessionData.class).withProperties(properties);

      {{ Configuration c = b.build();}}

      Show
      EmbeddedCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().jmx().build()); {{ }} Properties properties = new Properties(); properties.put("hibernate.search.mapping.configurer", "com.acme.MyMappingConfigurer"); Configuration dcc = cacheManager.getDefaultCacheConfiguration(); {{ ConfigurationBuilder b = new ConfigurationBuilder();}} {{ if (dcc != null)}} {{ b = b.read(dcc);}} b.indexing().enable().addIndexedEntity(InfinispanSessionData.class).withProperties(properties); {{ Configuration c = b.build();}}

      Using infinispan 13.0.2.Final upgrading from infinispan 11, I can no longer programmatically define an entity mapping for use with an embedded cache.  Following the suggestion in the infinispan documentation to refer to Hibernate 6 manual, I defined a HibernateOrmSearchMappingConfigurer class, then tried to set the required hibernate property hibernate.search.mapping.configurer. When I run my test class, I get the error:

      Nov 17, 2021 3:15:13 PM org.infinispan.configuration.cache.IndexingConfigurationBuilder create
      WARN: ISPN000612: Indexing configuration using properties has been deprecated and will be removed in a future version, please consult the docs for the replacements. The following properties have been found: '

      Unknown macro: {hibernate.search.mapping.configurer=com.acme.MyMappingConfigurer, hibernate.search.default.indexBase=/home/janb/src/jetty-eclipse/jetty-10.0.x/jetty-infinispan/infinispan-embedded-query/target/tests}

      '
      Nov 17, 2021 3:15:13 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
      INFO: HCANN000001: Hibernate Commons Annotations

      Unknown macro: {5.1.2.Final}

      Nov 17, 2021 3:15:14 PM org.infinispan.query.impl.LifecycleManager createQueryInterceptorIfNeeded
      INFO: ISPN014003: Registering Query interceptor for cache session_test_cache1637122510694
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.71 s <<< FAILURE! - in org.eclipse.jetty.server.session.infinispan.EmbeddedQueryManagerTest
      [ERROR] org.eclipse.jetty.server.session.infinispan.EmbeddedQueryManagerTest.test Time elapsed: 3.661 s <<< ERROR!
      org.infinispan.commons.CacheConfigurationException: ISPN000404: The configured entity class org.eclipse.jetty.session.infinispan.InfinispanSessionData is not indexable. Please remove it from the indexing configuration.
      at org.infinispan.query.impl.LifecycleManager.checkIndexableClasses(LifecycleManager.java:246)
      at org.infinispan.query.impl.LifecycleManager.cacheStarted(LifecycleManager.java:215)
      at org.infinispan.factories.GlobalComponentRegistry.notifyCacheStarted(GlobalComponentRegistry.java:332)
      at org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:704)
      at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:646)
      at org.infinispan.manager.DefaultCacheManager.internalGetCache(DefaultCacheManager.java:535)
      at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:513)
      at org.eclipse.jetty.server.session.infinispan.EmbeddedQueryManagerTest.test(EmbeddedQueryManagerTest.java:79)

      Note that the infinispan 13.0.2 manual still refers to the old hibernate 5 way of defining programmatic mappings which no longer works with hibernate 6, see https://infinispan.org/docs/13.0.x/titles/query/query.html#programmatic-entity-mapping_query-embedded)

              fercoli@redhat.com Fabio Massimo Ercoli
              janbartel Jan Bartel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: