]
Koen Aers updated JBIDE-23149:
------------------------------
Fix Version/s: 4.4.3.AM1
(was: 4.5.0.AM1)
Reverse engineering strategy cannot be set to custom class if
generation target is Hibernate 5.x
------------------------------------------------------------------------------------------------
Key: JBIDE-23149
URL:
https://issues.jboss.org/browse/JBIDE-23149
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: hibernate
Affects Versions: 4.4.0.Final
Reporter: Antal Varga
Assignee: Koen Aers
Fix For: 4.4.3.AM1
Attachments: BaseReverseEngineeringStrategy.java,
RMAReverseEngineeringStrategy.java
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.*