Код: Выделить всё
@Immutable
@Entity
@Table(name = "my_entity")
public class EntityA { ... }
< /code>
@Entity
@Table(name = "my_entity")
public class EntityB { ... }
< /code>
This works perfectly fine.
I now have to change one of these entities to extend an @InheritanceКод: Выделить всё
@Immutable
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Parent { ... }
< /code>
@Immutable
@Entity
@Table(name = "my_entity")
public class EntityA extends Parent { ... }
< /code>
@Entity
@Table(name = "my_entity")
public class EntityB { ... }
< /code>
I then get a DuplicateMappingExceptionКод: Выделить всё
org.hibernate.DuplicateMappingException: Duplicate table my_entity
< /code>
Is there a way to still reference the same table in an inheritance hierarchy?
My workaround would be to create a view based on the my_entityЯ использую Hibernate 5.6.15.>
Подробнее здесь: https://stackoverflow.com/questions/794 ... nheritance