Announcement Announcement Module
No announcement yet.
AbstractTransactionalDataSourceSpringContextTests and multiple SessionFactories Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AbstractTransactionalDataSourceSpringContextTests and multiple SessionFactories

    Hi all

    I'm using the spring class AbstractTransactionalDataSourceSpringContextTests, but since I have defined two SessionFactories and two DataSources (I have to connect to two different Databases), the spring container can't auto-wiring the beans by type.

    "No problem", I thought: just wire them manually. But I can't set a DataSource on the SessionFactory. And when I cast the SessionFactory to a LocalSessionFactoryBean, my DAO class doesn't accept it because it's based on the spring class HibernateDaoSupport which needs a SessionFactory.

    How can I wire these classes?

    Thanks for your help

  • #2
    pragmatic solution

    ok, I just found a pragmatic solution for my problem: I use two different contextfiles - one for each database-connection. therefore I can load the needed file in each of the two tests.

    Well, better solutions are still welcome!