You just need to define a second SessionFactory bean and inject it in the
DAO's that you need access to it. You'll have to manage this second session
opening and closing manually since the OpenSessionInViewFilter manages just
the the bean names "sessionFactory". You could setup a second OSIV filter
but it might be overkill depending on how frequently you need to fetch data
from your DB2 database.

I would personally use Ibatis for fetching read-only data since it takes a
lot of work to get Hibernate to perform efficiently as a data mapper alone
when you dont need its ORM capabilities. (Getting Hibernate to perform
efficiently when working with large amounts of read only data is a battle
I've almost given up on). However if would still like to use Hibernate for
your read-only DB2 data, make sure you're using Hibernate's StatelessSession
API or else you'll just be paying a huge CPU and memory overhead using
Hiberanate.

On 4/20/07, Nathan Anderson <[EMAIL PROTECTED]> wrote:

[ You thought I was kidding about the 60 seconds, huh? ;) ]

So I need to have 2 data sources in my application.  The AppFuse core
and my CRUD classes are being persisted to a MySQL database.  I also
need fetch Read-Only objects from a DB2 database.  Being new to maven
I'm a little stumped on how to add the JDBC jars for DB2.  But even
after I figure that out I'm not sure how to configure a second
dataSource.  I'm guessing I create a new "dataSource" bean, but I don't
see how to tell Hibernate or some other mechanism to connect to it.

Thanks,
Nathan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to