This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue while trying to map extended class  RSS feed

Mariano Austral
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have an issue with inheritance mapping, hope you can help.

Having the following structure:

@Table (name= "Persons")
@Inheritance (strategy=InheritanceType.JOINED)
public class Person implements Serializable {

@Id(name = "personId")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_PERSON")
private Long id;
@Column(name = "name")
private String name;

public class PersonWithDogs implements Serializable {

private List<Child> dogs;

//getters and setters

(This is just an example, the system does not have persons and dogs.)

I have the standard joined inheritance structure, but recently I had to add a specialization of Person that only contains a bidirectional oneToMany relationship. The mapped is being done by the "Dog" object so besides the dogs table I need to create no new tables. In addition, Person has other specializations with their own tables.

There is no "PERSON_WITH_DOGS" table since it's not necessary. How do I annotate this?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!