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.
|