Two Laptop Bag
The moose likes Object Relational Mapping and the fly likes how to map this hierarchy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "how to map this hierarchy" Watch "how to map this hierarchy" New topic

how to map this hierarchy

Ulas Ergin
Ranch Hand

Joined: Oct 10, 2002
Posts: 77
Hello all
let's assume i have 3 classes,first one,lets say F1 is a a mapped super class
second one,namely F2, is an entity derives from first one
and third entity class named F3 is derived from second one F2

now the problem:
I want to have 2 tables
T2 mapped by F2 having i1 and i2 [note i1 is coming from F1]
T3 mapped by F3 having i1 and i3 [note i3 is coming from F1]

unfortunately since F3 is derived from F2,I can have i1 only in F2
but I want to have that mapped superclass' fields in both

thanks in advance,

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

So, you want i1 duplicated in two tables? To me, that's a problem. I'm not saying there's not a way, but what's the point of having the value duplicated in two tables?

-Cameron McKenzie
Ulas Ergin
Ranch Hand

Joined: Oct 10, 2002
Posts: 77
hmm..i know it does not quite sound well... but let's say i am using the mapped super class,F1 as a way to imply some restriction to the system.
I mean ,all persistent objects must have field i1 and all db tables should have a field i1.

what is the way you are thinking to achieve this?
Ulas Ergin
Ranch Hand

Joined: Oct 10, 2002
Posts: 77
well..i guess this silence means no luck
Don't get me started about those stupid light bulbs.
subject: how to map this hierarchy
jQuery in Action, 3rd edition