We have a JPA entity model which consists of two different entities which are mapped to the same database table. The reason why two separate entities exists is that we use them in two separate parts of the application (separate application modules) and they differ in attributes which they hold. This scenario was working perfectly in Hibernate 4.2.18.
After upgrade to 5.2.10 (JPA 2.1), we started experiencing the DuplicateMappingException: Duplicate table mapping, which occurs on the application startup. The entities are defined as follows:
The exception we receive is:
Although we run this application on WebSphere, we do not use the default (built-in) Java Persistence provider.
Thanks in advance for any insight and suggestions.
WebSphere AS 9.0 (Classic Edition) + Oracle 12c
I saw that you changed the priority to Blocker. I'm not convinced that this is a Hibernate bug. Just because Hibernate did not throw an exception and seemed to work in 4.2 does not mean it is supported. AFAIK, there is no hibernate-orm unit test that tests this, and I don't think this is covered in the JPA 2.1 spec or the Hibernate ORM user guide.
AFAICT, this should be solved by reworking your inheritance hierarchy.
I will leave this open so you can respond in case I'm missing something in the JPA 2.1 spec or user guide that shows this should be supported.