Results 1 to 2 of 2

Thread: Multiple datasources and thus multiple sessionFactories

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Posts
    6

    Default Multiple datasources and thus multiple sessionFactories

    We are using 2 datasources and therefore defined 2 different sessionFactories in the application context files.
    Problem is that OpenSessionInViewFilter can only fetch 1 sessionFactory.

    How can we solve this within the logic of the framework ?
    Subclass OpenSessionInViewFilter so that it can fetch a list of sessionFactories.

    Edwin

  2. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    You could configure two filters. When OpenSessionInViewFilter fires, it creates a new Hibernate session (if none can be found) and registers it within TransactionSynchronizationManager using sessionFactory as the key. Since you are using two sessionFactories, you can use two Hibernate Session at the same time.

    HTH
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

Posting Permissions

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