Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-23149

Reverse engineering strategy cannot be set to custom class if generation target is Hibernate 5.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.4.3.AM1
    • 4.4.0.Final
    • hibernate
    • None
    • devex #124 December 2017
    • 8
    • Hide

      Set a custom reverse engineering strategy in Eclipse JBoss Tools Reverse Engineering Launch configuration.
      Try to set Hibernate target version to 4.3 for Hibernate console definition => works
      5.0 or 5.1 => does not work, throws ClassNotFoundException into Error log

      Show
      Set a custom reverse engineering strategy in Eclipse JBoss Tools Reverse Engineering Launch configuration. Try to set Hibernate target version to 4.3 for Hibernate console definition => works 5.0 or 5.1 => does not work, throws ClassNotFoundException into Error log

      The reason for that is the change in ServiceImpl.java in org.jboss.tools.hibernate.runtime.v_5_0*.jar or later.

      private Object newReverseEngineeringStrategy(String className, Object delegate)

      {...}

      tries to load class using the class loader of the delegate object at first which is org.hibernate.cfg.reveng.OverrideRepository and resides in hibernate-tools-x.yy.jar.

      The main problem is that while in case of the earlier Hibernate generation targets (e.g. 4.3) the reverse engineering strategy class loading was done by org.hibernate.util.xpl.ReflectHelper (and worked well), this option

      happens only as a fallback case now BUT this only happens if the constructor has not been found (only NoSuchMethodException is caught).

      Therefore a reverse engineering strategy can only be loaded if it is loaded by the classloader of the hibernate-tools-x.yy.jar or one of its parent loaders (OSGI can make the things more complicated).

      I think the solution would be to catch ClassNotFoundException as well and try to load reverse engineering class using ReflectHelper in this case.

            kaers@redhat.com Koen Aers
            vanti1980 Antal Varga (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: