-->
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: Set Table at Runtime
PostPosted: Tue Sep 21, 2010 12:48 pm 
Newbie

Joined: Tue Sep 21, 2010 12:30 pm
Posts: 1
Hello, this is my first project using Hibernate so I have very little experience but also haven't found the solution to this on Google, I see a lot of posts asking this same question, but never any clear answers on what the solution is so I figured it's time to ask the pros.

Essentially my problem is I have 1 database containing all my tables of 3 basic types, Users, Groups, Addresses. Now to save on performance my those 3 types have been split into the respective state of where they are located. Exampling being as follows.

---Arizona Users---
Agent_AZ
Groups_AZ
Addresses_AZ
---California Users---
Agent_CA
Groups_CA
Addresses_CA

Both Agent_AZ and Agent_CA will always have the same structure and the same can be said about the other types, the only difference between them is that Arizona doesn't need to ever look-up / hold the information from the California as they never need to know each other exist at ANY point of time. My project has the 3 classes for the structure of the columns using Annotations and I know on a normal implementation you can just use Table(name="Agent_AZ") but obviously I don't know Agent_AZ until I've gotten some information from the user so I basically need to accomplish Table(name=agentState).

One thing that should be said is once I've set the table at no point do I ever need to change it again, they are stuck with those tables until the end of the application life cycle so I do not need to constantly change the table, only set it initially at runtime. I know if I really wanted to I could probably just make 50 Agent Classes that extend the base Agent class all with there own respective state name but I figured there has to be a more manageable way to accomplish this as that just seems silly... If you have an answer or a suggestion please keep in mind I'm extremely new to Hibernate so I may need detailed explanations to keep up. Thank you in advanced.


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.