-->
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: Dynamic Mapping column to table
PostPosted: Thu Apr 17, 2014 12:05 am 
Newbie

Joined: Wed Apr 16, 2014 11:53 pm
Posts: 1
Hi,

I have a legacy system that have its own database already in production. In this system, there is a table that contains a pure string, which leads to another Table and its value.

The case is like the following, where the current system uses the Destine as a Table and DestineId as this Table primary key value.

Table1

ID, Active, Destine, DestineID
1, true, Client, 1;
2, true, Client, 2;
1, true, Address, 5;

What is the best practice for me to update this table and map this in Hibernate?

I considere the following:


1-Create a superclass for this "Destines", which would have a Enum telling its Type
2-Create a column for every possible "Destine" table (someplaces this can be up to 10 distinct tables)
3-Create a superclass for "Destines", which would have a column for every possible "Destine"

Note: Changing this relation will reflect in many modules, so i need to keep as easy as posssible to upgrade


I dont know what are the best practices for this case, maybe there is something i cant see...

How would you do this mapping?
Please tell me if the example is not so clear


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.