Announcement Announcement Module
Collapse
No announcement yet.
Single Router SessionFactory AND Multiple Real-Time .... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Single Router SessionFactory AND Multiple Real-Time ....

    Hi,
    spring: 1.2
    hibernate: 3

    I have a project where I try to make A single Router Database with single SessionFactory. Where it will hold definition of multiple Databases.
    i.e:
    ROUTER_SERVER table (server_id, server_name, driver_class, url, user, pass, active);
    ROUTER_SERVER_MAP (customer_id, server_id)

    in applicatonContext.xml i define
    a single Router SessionFactory with his DAO.
    after that, i wnat to create real-time beans according to ROUTER_SERVER table( also i want to delete them according to active field).
    so when customer Log-in it will make connection to appropriate database with appropriate DAO (different than Router DAO).

    so how can i do it, anybody here tried something like this?

    thanks for advance

  • #2
    First I think you are better off asking this question on the HB forums.
    The solution to your problem depends of what type of operations you are trying to do - if you are thinking of distributed transaction then take a look at EJB.
    Otherwise I if you just want to use different databases - implement a DAO Delegate (what a mistmatch of terms ) that simply contains all the approapriate DAOs and redirects the call to the approapriate DAO after doing a lookup.

    Expose the DAO through a generic interface and you should work with it as you would with a normal DAO.

    Comment


    • #3
      Originally posted by costin
      Otherwise I if you just want to use different databases - implement a DAO Delegate (what a mistmatch of terms ) that simply contains all the approapriate DAOs and redirects the call to the approapriate DAO after doing a lookup.

      Expose the DAO through a generic interface and you should work with it as you would with a normal DAO.
      hi costin,
      that's exactly what i ask. there will be a router dao, router service
      and generic dao, generic service.
      i'll use generic dao for all databases all other databases.

      that's not a hibernate question, nor transaction, nor ejb. it's a real-time bean creation/management and accesibility question.

      Comment


      • #4
        I wasn't sure what exactly you meant . Anyways, a sessionFactory offers connections to only one database - in your case by using several DBs you have to use several sessionFactories which affects the transactional aspect of your application.

        Comment

        Working...
        X