-->
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: Dynamic Hibernate Mapping
PostPosted: Mon Dec 29, 2008 9:34 am 
Newbie

Joined: Mon Dec 29, 2008 9:26 am
Posts: 2
Hello everyone - This is my first post and was wondering what the best way (or recommendation) for changing mappings dynamically.

What I have is a MS Db (or multiples) from a 3rd party and depending on the version of the application, the hibernate mappings need to change.

For example: Table 1 tells me the version of the application and when Table 1 says 11, then the type column in Table 2 means (say) Object X, but when Table one says 12, then the type column in Table 2 means Object Y.

My goal is to read the version from Table 1 and when it's 11 then map (subclasses actually) Object X to type 1, Object Y to type 2.

But when Table 1 says it's 12 I need to switch the subclass mapping to Object X to type 1 and Object Z to type 2, switching Object Y from 2 to 3.

Let me know if I need to post more details.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 02, 2009 5:11 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
The only thing that comes to mind is executing some straight JDBC queries at startup and then using the info gained to build a SessionFactory programmatically. You'd then ship all supported versions of a mapping (and entities?) with your application and choose them based on the initial non-Hibernate queries.

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


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.