Uploaded image for project: 'WINDUPRULE - Red Hat Application Migration Toolkit rules'
  1. WINDUPRULE - Red Hat Application Migration Toolkit rules
  2. WINDUPRULE-368 EAP 7.2 Migration: Hibernate ORM 5.1 to Hibernate ORM 5.3 App Migration
  3. WINDUPRULE-380

EAP 7.2 Migration: Hibernate ORM 5.1 to Hibernate ORM 5.3 App Migration - references to SessionFactory and SessionFactoryImplementor

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • Sprint 63, Sprint 64

      Documentation (preview) about the[ issue:|https://doc-stage.usersys.redhat.com/documentation/en-us/jboss_enterprise_application_platform_continuous_delivery/14/html-single/migration_guide/#migrating_from_hibernate_5_1_to_5_3
      ]

      An abstract (yet working) Hibernate 5.3 PoC rule may be found at https://github.com/emmartins/windup-rulesets/blob/WINDUPRULE-372/rules-reviewed/eap7/eap71/hibernate51-53.windup.xml , which should be broken into multiple rules targeting each concrete Hibernate 5.3 migration issue at https://github.com/hibernate/hibernate-orm/blob/5.3/migration-guide.adoc

      Note the example rule reference above should have the EAP Traget set to
      <targetTechnology id="eap" versionRange="[7,8)" />

      5.2 migration notes: "SessionFactory and SessionFactoryImplementor each had a number of methods dealing with cache regions.
      Many of these methods have been deprecated since 5.0 and those will be removed. However, the functionality has been moved into the `org.hibernate.Cache` and `org.hibernate.engine.spi.CacheImplementor` contracts helping implement JPA's `javax.persistence.Cache` role."

      Windup rules:

      When: reference to org.hibernate.engine.spi.SessionFactoryImplementor.getQueryCache() method is found
      Perform: org.hibernate.engine.spi.SessionFactoryImplementor.getCache().getDefaultQueryResultsCache() should be used instead.

      When: reference to org.hibernate.engine.spi.SessionFactoryImplementor.getQueryCache(String regionName) method is found
      Perform: org.hibernate.engine.spi.SessionFactoryImplementor.getCache().getQueryResultsCache(String regionName) should be used instead.

      When: reference to org.hibernate.engine.spi.SessionFactoryImplementor.getUpdateTimestampsCache() method is found
      Perform: org.hibernate.engine.spi.SessionFactoryImplementor.getCache().getTimestampsCache() should be used instead.

      When: reference to org.hibernate.engine.spi.SessionFactoryImplementor.getSecondLevelCacheRegion(String regionName) method is found
      Perform: org.hibernate.engine.spi.SessionFactoryImplementor.getCache().getRegion(String regionName) should be used instead.

      When: reference to org.hibernate.engine.spi.SessionFactoryImplementor.getSecondLevelCacheRegionAccessStrategy(String regionName) is found
      Perform: Depending on the type of region, the appropriate method should be used instead. For an entity cache region, org.hibernate.engine.spi.SessionFactoryImplementor.getMetamodel().entityPersister( entityName ).getCacheAccessStrategy() should be used instead. For a collection region, org.hibernate.engine.spi.SessionFactoryImplementor.getMetamodel().collectionPersister( role ).getCacheAccessStrategy() should be used instead. For a natural ID region, org.hibernate.engine.spi.SessionFactoryImplementor.getMetamodel().entityPersister( entityName ).getNaturalIdCacheAccessStrategy() should be used instead.

      When: reference to org.hibernate.engine.spi.SessionFactoryImplementor.getNaturalIdCacheRegion(String regionName) method is found
      Perform: org.hibernate.engine.spi.SessionFactoryImplementor.getCache().getRegion(String regionName) should be used instead.

      When: reference to org.hibernate.engine.spi.SessionFactoryImplementor.getNaturalIdCacheRegionAccessStrategy(String regionName) method is found
      Perform: org.hibernate.engine.spi.SessionFactoryImplementor.getMetamodel().entityPersister( entityName ).getNaturalIdCacheAccessStrategy() should be instead.

      When: reference to org.hibernate.engine.spi.SessionFactoryImplementor.getAllSecondLevelCacheRegions() method is found
      Perform: org.hibernate.engine.spi.SessionFactoryImplementor.getCache().getCacheRegionNames() should be used to obtain all cache region names, then org.hibernate.engine.spi.SessionFactoryImplementor.getCache().getRegion(String regionName) should be used to look up each region.

      ------------------------------------------------------------------

              mrizzi@redhat.com Marco Rizzi
              pcattana Philip Cattanach
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: