-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Issue while trying to map extended class
PostPosted: Tue Dec 22, 2009 4:43 pm 
Newbie

Joined: Fri Jul 14, 2006 2:21 pm
Posts: 2
Hi all,
I have an issue with inheritance mapping, hope you can help.

Having the following structure:

Quote:
@Entity
@Table (name= "Persons")
@Inheritance (strategy=InheritanceType.JOINED)
@SequenceGenerator(
name="SEQ_PERSON",
sequenceName="SEQ_PERSON")
public class Person implements Serializable {

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

@Entity
//DONT KNOW WHAT TO DO HERE
public class PersonWithDogs implements Serializable {

@OneToMany(mappedBy="owner",cascade=CascadeType.ALL)
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?

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.