Results 1 to 5 of 5

Thread: Single web application in Single Database Shared Schema mode.

  1. #1
    Join Date
    Jun 2008
    Location
    Chennai, India
    Posts
    5

    Default Single web application in Single Database Multiple Schema mode.

    I am developing the single web application which needs to support multiple schema using the Spring-Hibernate framework.

    In order to acheive the same, I used the code(ContextSwappableTargetSource- MultiSessionFactoryTargetSource.java, ContextHolder.java) uploaded in this forum.

    I am declaring all the session factories in the config file and I make a intercept call on every request and put the particular schema to connect in the context. Then the DAO will take the corresponding session factory's session to do the operation.

    I did this as a simple sample application and everything works fine.

    Whether i can proceed with the same to develop the real application, will their be any hidden problem in this method?

    By the way, the real application will be hosted in single application server and 15-20 concurrent users for the initial phase of deployment. 100-200 concurrent users to be added up, over a period of 6 months.
    Last edited by arvindkumarc; Dec 17th, 2009 at 07:06 AM.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    I suggest not using multiple SessionFactories but multiple datasources, it is much more lightweight. This exact method is used in an application which host 50 different clients on a single tomcat with a couple of 100 to 1000 concurrent users without any problems.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jun 2008
    Location
    Chennai, India
    Posts
    5

    Default

    Are you maintaining separate database for each client?

    In our case we have to maintain single database with multiple schema each for a particular client.

    how to define the schema in the datasource such that we can have multiple datasources?

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    We had a mixture of single and multiple databases. In our case each client had its own username/password which was tied to a particulair schema., so basically defining multiple datasources was enough. I also assume you have something similair, if not I suggest you start doing it. It also adds an extra layer of security.

    If it is only a single database you have you might instead want to take a look at the UserCredentialsDataSourceAdapter, that creates a connection for a certain user. Drawback of that approach is that it doesn't use a connection pool.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5

    Default Single web application in Single Database Shared Schema mode.

    Dear Aravind can you provide us sample code or project which you have developed?
    (ContextSwappableTargetSource- MultiSessionFactoryTargetSource.java, ContextHolder.java)
    It is very needful to us.


    Thanks & Regards,

    Vamsi R Krishna

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •