-->
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: Persisted object evolution
PostPosted: Wed Jul 28, 2004 5:37 am 
Newbie

Joined: Wed Jul 28, 2004 4:39 am
Posts: 1
Hello,

I'm trying to see if I could use Hibernate in my development, and I'm trying to see if it could fit my needs but I'm a bit lost.

I'm working on an application that perform it's own O/R mapping. This application is storing metadata in a mysql db, and generate the data tables thanks to those metadata.

How does it work ?

Let's talk about an object class I need to persist : MyObject
My class can have different definition from one database to another :

Code:
public class MyObject // Definition for the database 1
{
  private String fieldA;
  private float  fieldB;
}

public class MyObject // Definition for the database 2
{
  private String fieldA;
  private int    fieldB;
  private int    fieldC;
}


What does it means ?

I have some metadata informations that are telling me that :
    -fieldA represent the same data in the 2 definition
    -fieldB represent the same data but encoded differently
    -fieldC is an extra information provided in db2
What do I need ?

In my application I can change the metadata definition. My application automatically update the db table structure without losing data.

example :

Code:
I migrate a db1 structure to a db2 structure :

MyObject table before :

+--------+--------+
| fieldA | fieldB |
+--------+--------+
| test   | 3.14   |

MyObject table after :

+--------+--------+--------+
| fieldA | fieldB | fieldC |
+--------+--------+--------+
| test   |  3     | null   |


This is an example, I could need to migrate a db2 structure to a db1 structure.

Finally, my question is...

I've search in the documentation how hibernate was handling that kind of stuff, but I don't know where to start and I haven't been able to find something. I guess there's a mechanism to allow the persisted object to evoluate from one version to another, and to update the db table, but I'm lost...

Does somebody could give me an hint, a keyword, anything ?


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.