0

I'm working on a legacy project that uses Hibernate's SessionFactory directly instead of EntityManager. I currently need to register a certain third-party class as mapped superclass so Hibernate will know how to persist entities that are subclasses of that class. But, as I can't modify the source, I cannot place necessary annotations on it. Is there some other way to register it as mapped superclass?

I know I can define such mapping in orm.xml file but since my project does not depend on Hibernate's JPA implementation, it won't be parsed by Hibernate.

Jagger
  • 23
  • 1
  • 3
  • Possible duplicate of [Spring & Hibernate without jpa](https://stackoverflow.com/questions/32904513/spring-hibernate-without-jpa) – naXa stands with Ukraine Jun 19 '17 at 12:25
  • What version of Hibernate? Why can't you depend on Hibernate's JPA implementation and define the mapping in orm.xml? – naXa stands with Ukraine Jun 19 '17 at 12:27
  • @naXa Hibernate's version is 4.3.11.Final. The project is quite big - it has more than 100 DAOs and each one of them depends directly on SessionFactory and Hibernate's criteria so migrating to EntityManager would take a lot of time. The answer you linked shows a way to map concrete entity class by using hbm.xml file, but I need a way to register mapped superclass. As far as I know, there is now way to define a mapped superclass in *.hbm.xml file, but if there is, I will accept an answer that shows how. – Jagger Jun 20 '17 at 13:57

0 Answers0