-->
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 hierarchy as "disjoint" entities
PostPosted: Wed Jun 20, 2007 6:51 pm 
Beginner
Beginner

Joined: Wed Apr 18, 2007 1:44 pm
Posts: 27
Hi all,

(I'm posting this here because I'm not sure if it's just annotation related or about a more general hierarchy mapping concern)

I have a hierarchy where class B extends class A. Both are entities:

Code:
@Entity
class A {
}

@Entity
class B extends A{
}


with the above annotations hibernate will try to map A and B as a SINGLE_TABLE hierarchy.Also, with TABLE_PER_CLASS it will forbid AUTO ids. But as I don't care to treat A and B polymorphically it would be fine for me to just map them as different classes, disregarding their inheritance relationship. Something like that could be achieved, although a bit laboriously, as:

Code:
@MappedSuperclass
abstract class  X {
}

@Entity
class A extends X{
}

@Entity
class B extends X {
}


Is there any way to do the same thing avoiding this somewhat synthetic abstract class expedient.

Thank you in advance
Cheers,
Carlos


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.