Search code examples
javahibernateinheritancejpa

JPA Inheritance: same property in different subclasses


so I have a single table inheritance with A being my base class and A1,A2,A3 all extend A. A2 and A3 both have a property named "name". Will it get me in trouble if I map A2.name and A3.name to the same table column? I'm not getting any errors so far, but I'm worried about strange behavior in the future.

I'm using hibernate 4.3+


Solution

  • so far I haven't encountered any problems, so it's all good.

    But this is only the case for normal properties. Adding A2.address and A3.address where "address" is a ManyToOne- or OneToOne- Relation to another entity, then things will not work anymore.