-->
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.  [ 2 posts ] 
Author Message
 Post subject: Can you solve this mapping dilemma?
PostPosted: Tue Apr 03, 2007 12:10 pm 
Newbie

Joined: Thu May 18, 2006 10:00 am
Posts: 12
I'm currently trying to map a hashmap of name-value pairs in an entity. Seems easy enough, but I am working against a legacy schema which, of course, cannot be changed. The problem is the existing schema which in a distilled form is as follows:

table: ENTITY_TABLE
column: entity_id
column: hashmap_id
primary key: entity_id
foreign key: hashmap_id to table HASHMAP_TABLE

table: HASHMAP_TABLE
column: hashmap_id
column: name
column: value
primary key: (hashmap_id, name)

Normally the foreign key is in the HASHMAP_TABLE pointing back to the ENTITY_TABLE which would make things very easy. The problem is that the hashmap table is shared among many entities so there can be no foreign key in HASHMAP_TABLE.

How would you solve this assuming you can't modify the schema in any way?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 5:22 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
what about many2one?

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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