Oct 29th, 2011, 05:27 AM
Different Databases for different users to separate data?
I am no total newby to Spring, but I am far from being an expert. I hope you can help me.
I am planning a web application that will have a start-page with news, infos and the like.
There will be a login for registered users to access their private data.
How would you suggest I separate the data of the different users?
I thought about including in every object the corresponding user. And then manage the access rights in the spring application.
Then I thought maybe I could use a single database for every user. Then I would not need to manage the access rights. How would I do this in Spring with Hibernate? I used Spring and Hibernate but all my objects were loaded at startup via Hibernate and not when a user logged in...
What whould you suggest to manage the user data? Any tip is welcome!
Nov 10th, 2011, 12:02 AM
Single database for every user? What if you have 1000 users? That means 1000 databases? 1 million users = 1 million databases?
Isn't that too much waste of resources? And what database are you going to use? MySQL? You'll probably go for NoSQL type databases then.
I suggest implementing ACL with Spring Security instead of 1 user per database. You can load specific data depending on the authorized user and the access rights given to the object. Maybe you can start by checking the following tutorial:
Spring Security 3: Full ACL Tutorial
Dec 24th, 2011, 06:15 PM
Nobody does that. That's a nightmare solution.
Originally Posted by Huehnerbrust
You need to implement a session that identifies the user, and an ACL which holds the objects a user is entitled to access. There is no reason why hibernate should fetch all your objects on startup, check your config there is likely an error somewhere, perhaps hidden in your application logic.
Jan 15th, 2012, 01:56 PM
Sorry for the question. After some reading it sounds really stupid to me....
I will do it like you suggested with ACLs.
Feb 5th, 2012, 10:22 AM
its so nice to visit here a nice thread. Am so impressed with your such a good hard work, its definitely a good and diferent idea for others, you guys are doing good work good luck, keep it up..
Link Building is an important tool of Seo Services.
Feb 24th, 2012, 07:19 AM
I don't know if this would be the best way to do it, but I would look into developing two separate classes, one to work with each database. That way, anytime you would need to update the data, you could just send the data into each of the classes and each class would update the corresponding database. I know that you would be duplicating some code, and that kind of defeats the purpose of the class, but then again, the customer already is duplicating data in the databases and doesn't want to move to a single database.
ccie voice lab