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.  [ 5 posts ] 
Author Message
 Post subject: Two classes mapping on one table
PostPosted: Thu Mar 18, 2004 4:47 am 
Newbie

Joined: Wed Mar 03, 2004 10:19 am
Posts: 11
Location: Netherlands
Is it possible to have two classes that map on the same underlying database table? For example, a nice class hierarchy (table-per-class-hierarchy strategy) and a 'flat view' class that maps 1:1 on the database table?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 18, 2004 5:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yes, it is possible. You might need to understand the impact of polymorphism="explicit".


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 18, 2004 6:33 am 
Newbie

Joined: Wed Mar 03, 2004 10:19 am
Posts: 11
Location: Netherlands
Thanks Gavin. I thought I read that somewhere, but couldn't find it anymore.

If the dynamic-class feature will become available as well (can't wait for 2.2 !) this would be really great: both structured domain access to your database as well as straightforward 'flat' access without having to generate dumb java classes which just mimic the database tables.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 18, 2004 6:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yeah I know :-)

What I would love is to be able to support "generic" code (via HashMaps) and "typesafe" code (via classes) off of the same mapping file. We'll see how we could make that work....


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 03, 2004 12:21 pm 
Beginner
Beginner

Joined: Tue Jun 22, 2004 3:16 pm
Posts: 35
Gavin: I am reading your "Hibernate in Action" book and I can not find this two classes map to one table information.

Thanks,

J


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.