-->
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: Mapping class hierarchy with inherited ID
PostPosted: Thu Jul 17, 2008 1:56 pm 
Newbie

Joined: Thu Jul 17, 2008 1:24 pm
Posts: 9
I am moving from xdoclet to hibernate annotations. My Class hierarchy goes like this.



Code:
@MappedSuperclass
public abstract class Model implements Serializable {
     private Long UID;

     @Id @GeneratedValue(strategy=GenerationType.Sequence)
     public Long getUID() {
          return UID;
     }

     /*
          other shared data
     */
}

@Entity
@Table(name="ADDRESS")
@SequenceGenerator(
     name="ADDRESS_SEQ"
     sequenceName="ADDRESS_SEQ"
     allocationSize=1)
public class Address extends Model {
/*
   other mapped data
*/
}

@Entity
@Table(name="PERSON")
@SequenceGenerator(
     name="PERSON_SEQ"
     sequenceName="PERSON_SEQ"
     allocationSize=1)
public class Person extends Model {
/*
   other mapped data
*/
}


The question is can I have a base class annotate the id and have individual sequences generate the id? By looking at the log output everything seems to be set up correctly but inserts fail because it is still looking for "hibernate_sequence".


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.