Announcement Announcement Module
Collapse
No announcement yet.
Different Databases for different users to separate data? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Different Databases for different users to separate data?

    Hi everyone!

    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!

    Thank you!
    Dominik

  • #2
    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
    http://krams915.blogspot.com/2011/01...-tutorial.html

    Comment


    • #3
      Originally posted by Huehnerbrust View Post
      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...
      Nobody does that. That's a nightmare solution.

      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.

      Comment


      • #4
        Sorry for the question. After some reading it sounds really stupid to me....
        I will do it like you suggested with ACLs.

        Thanks

        Comment


        • #5
          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.

          Comment


          • #6
            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
            ccie voice lab
            msp training

            Comment

            Working...
            X