-->
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: Hibernate mapping questions
PostPosted: Fri Feb 18, 2011 11:59 am 
Newbie

Joined: Fri Feb 18, 2011 11:14 am
Posts: 1
I am trying to build a hibernate layer on top of an existing database.

This existing database has few foreign keys/ constrains; it used to rely on storeproc to update, so that it hopefully could maintain data integrate. Most of the tables use composite key as primary key

Some tables here: Profile, Address, ProfileAddress
Profile primary key: profileId + profileVersion
Address primary key: addressId + addresVersion
ProfileAddress primary key: profileId + profileVersion +addressId

there is not constrain between these tables..


I tried to map these tables in a way that ProfileAddress can return Profile object or even better return address as well.. eg, profileAddress.getAddress, getProfilel. So far, I have no luck;
I saw most of the hibernate mapping example, they mostly using a single column as a key column, i wonder if this is possible to do with composite key, also there is no foreign key references.

Another weird thing about this db is, some entities are versioned in their tables.
For example, when a profile is update, it adds a new row of profile with different version number and the old row still lives in the same table...

I wonder the version tag can be used for this case, given version is part of the primary key




Any insight are appropriated.
Thanks for your help!


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.