-->
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: ManyToMany mapping and Interfaces?
PostPosted: Thu Oct 04, 2007 3:24 pm 
Newbie

Joined: Thu Oct 04, 2007 3:08 pm
Posts: 1
Hi all,

New here and fairly new to hibernate so please bear with. have trawled docs and not found any suggestions for this so here goes;

I have an object, say "Transaction". It has one or more "Item"s. These items can be either "Treatment"s, "Course"s or "Product"s.

Each of those Items implements a common interface "SaleableItem". And my Transaction object has a List<SaleableItem> property.

I'm trying to map this into the DB with Hibernate annotations and am not really sure how to.

The DB tables I want to end up with are;

Transaction (ID, ...)
TransactionItem (ID, TransactionID, ItemID and ItemType)
Treatment (ID, ...)
Course(ID, ...)
Product(ID, ...)

Am ok with the standard mapping of Transactions, Treatments, Courses, etc.. but not sure how to map the List<SaleableItem> property of Transaction to the TransactionItem table such that when i retrieve a Transactions items I end up with a List of the relevant objects (Treatment, Course or Product).

Is this possible?? Any suggestions?? Or is this bad OO??
Many Thanks


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.