-->
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: mapping a table with name and value columns to properties
PostPosted: Tue Dec 13, 2005 4:24 am 
Newbie

Joined: Tue Dec 13, 2005 4:10 am
Posts: 1
Hibernate version: 3.1

Suppose we have a simple (legacy) table which mimics a map with column name, column value and a foreign key to a record in another table. e.g.
Code:
NAME_VALUE_TABLE

NAME  VALUE    KEY
text1 foo      1
text2 bar      1
text1 nother   2
text2 nbar     2

PERSON_TABLE
ID NAME  FIRSTNAME
1  name1 firstname1
2  name2 firstname2


We could have a class Person like this:
Code:
public class Person {

....

    public String getFirstname();
    public String getName();
    public String getText1();
    public String getText2();

...
}



This means that the columns of person_table are mapped to the first two properties, and the other two name-value pairs are mapped to text1 and text2. You could say that this is the inverse of dynamic component, where columns are mapped to a map. Here you map map-entries to properties.
The arguments for this design are feasible for our purposes.
Is this possible using standard mapping, or do we have to use event-interceptor based methods?
James


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.