-->
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: Multiple schema problem
PostPosted: Fri Feb 08, 2013 5:32 am 
Newbie

Joined: Fri Feb 08, 2013 5:10 am
Posts: 2
Hello everybody,

I try to find the best solution for a new implementation of a software and hope to find a way to do this with Hibernate. Maybe you can give me a hint how you would design this. Facts are as follows:

1. The Database (MySql) is already existent - so no (big) redesign is possible.
2. There is one scheme (actually PHPMyAdmin calls it databases which confuses me even more ;)) containing the base data. Lets asume we have names, adresses etc of
Customers. Each Customer has its unique ID
3. There are N schemes containing the business data. Lets assume its information about the products the customers ordered. Each scheme contains alot of tables - but the structure of each table is the same in the different schemes. To split the data between different schemes is a need of datasecurity.

So - I want Hibernate to get me an object of one order (businessdata) and automatically fetch a customer object according to the customer-id stored in the data. So I have a relation between the two different schemes.

After a lot of searching I found that there is this "schema" attribute within the table-annotation that might be used in that kind of situation. Do I get this right?

But one problem remains - if i use this attribute I have to hardcode it in the sourcecode - so I need to code all objects (at least inherit em) for each of the N schemes... which seems to me a bit ugly because of the possibility to forget one entry (copy/paste error) and then overwriting data in the wrong scheme without ever recognizing. So - if this scheme-attribute is the solution for my problem - is it possible to set this dynamically so I can use only ONE SET OF CLASSES for the N schemes?

Thanks a lot!

Regards, Void


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.