-->
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.  [ 3 posts ] 
Author Message
 Post subject: can't map <subclass> to a table
PostPosted: Mon Jun 28, 2004 12:43 pm 
Newbie

Joined: Mon Sep 01, 2003 7:10 am
Posts: 4
Hi,

what i would like is to have the functionality provided by the <subclass> mapping, but where the properties defined for each subclass are specified in different tables.

For example:
Table MICROCHIPPED_CAT extends Table CAT
Table MICROCHIPPED_CAT has the property MICROCHIP_TAG_ID

I would like to define hibernate <class> mappings for both tables, and then within the CAT table use <subclass name="MicroChippedCat" discriminator-value="MCCat"/>.
The problem with this, is that Hibernate complains i'm tryin to map MicroChippedCat twice :(

I could move the MICROCHIP_TAG_ID property to the CAT Table, but that doesn't logically fit because of course not all cats have to or have been microchipped.

Also i do not want to use the <join-subclass> mapping, because i don't want Hibernate to join the two classes every time i query the CAT table.

Any suggestions/ideas on this subject?

cheers,
chico.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 1:19 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
joined-classes does not join classes, it join tables to get the appropriate class hierarchy.

The join is mandatory because Hibernate has to know the (sub-)type of this instance.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 29, 2004 5:30 am 
Newbie

Joined: Mon Sep 01, 2003 7:10 am
Posts: 4
sorry, I meant join tables not classes.

I guess what i really want is to have a <joined-subclass> which maps to a defined column of it's superclass (not the superclass primary key column) and to have an associated discriminator-value for that <joined-subclass>.

cheers,
chico


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

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.