-->
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: How to map an abstract class without specifying a table?
PostPosted: Tue Apr 01, 2008 3:20 am 
Beginner
Beginner

Joined: Thu Oct 26, 2006 4:45 am
Posts: 39
Is it possible to map only the concrete classes to existing tables while not mapping the abstract class onto a table itself?


Example:
I have a one-to-one relation from an OrderLine class to an abstract Product class. So, product is a property(component) of OrderLine.

Now I only have tables for the OrderLine itself and the concrete products Car, Hotel, Insurance.
That is, within the Orderline-Table there are foreign keys for these concrete classes like this:

OrderLineTable
columns..
HotelId (FK to HotelProduct table)
CarId (FK to CarProduct table)
InsuranceId (FK to Insurance table)

I wanted to map this in the Orderline mapping file with a one-to-one relation to Product, but than I have to specify a table for the abstract Product class.

I do not want to change the database: What would be the best approach here?


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.