-->
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: Mapping to legacy database - key/value style association
PostPosted: Tue Feb 10, 2009 6:42 pm 
Newbie

Joined: Tue Feb 10, 2009 6:33 pm
Posts: 2
Hibernate version: 3.2.6.ga
Mapping documents: no - annotations
Code between sessionFactory.openSession() and session.close(): y
Full stack trace of any exception that occurs: n/a
Name and version of the database you are using: Oracle 10g
The generated SQL (show_sql=true):n/a
Debug level Hibernate log excerpt: n/a

Hi all,

I'm attempting to figure out how to map to a legacy database schema and am out of ideas on how to perform this association

Here's a rough sketch of what I'm dealing with from an object level:

A
id
Map<String, String> info;

B
id
Map<String, String> info;

A is in its own table
B is in its own table

And info has a table similar to the following
obj_id, obj_type, field_name, field_value

The following assumptions are in play
obj_id would be an object ID of A or B
obj_type would be a discriminator value like "A_TYPE" or "B_TYPE"
field_name would be a "map key"
field_value would be a "map value" associated with field_name

obj_id, obj_type, field_name are a composite key for the table

What I can't figure out is a clean way to map it to the A & B definitions defined earlier.

Any help would be appreciated.

Thanks.
--Dave


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 9:00 pm 
Newbie

Joined: Tue Feb 10, 2009 6:33 pm
Posts: 2
I think I have another angle on this.

Basically, I'm writing this as a read-only access layer for an existing schema.

I'm wondering if I can approach this as an entity with an embedded ID.

I'll try my take on it and see if I can get some success with making this work and post my findings back here.

This is not an ideal solution as I'm going to have to post process this into a Map but I think it will cover what I need.


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.