-->
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: Dynamically assigning table names
PostPosted: Thu May 19, 2005 11:56 am 
Newbie

Joined: Thu Feb 24, 2005 6:10 am
Posts: 1
Problem:
I've a set of huge tables (mapped to hibernate objects) containing a week's data. Once a week is over, I rename the tables by adding some suffix (for eg. MyTable renamed to MyTable_1) & create new tables to continue with the new week.

In some places, I want to access the data from previous week's tables using hibernate.

Solution in my mind:
1. Create a Configuration object with the normal class-to-table mappings.
2. Iterate over all the Table instances & add the suffix to the table name.
3. Create SessionFactory & sessions using this configuration, without affecting the original SessionFactory.

Questions:
1. Is this the best approach? Will I face any problems by following this like caching?
2. If this approach is correct, then I need some easier API to get Table handle from Configuration. Currently I've to iterate through all PersistentClasses, Properties & so on. I noticed that all Table instances are there in Configuration class itself. It will be really helpful, if accessor is provided for this also.

Thanks in advance,
Karthi

Hibernate version:2.1.4

Name and version of the database you are using:MySQL 4.1.3 beta


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.