Hi!

We are using cocoon 2.2 and hibernate. I am not sure if we choosed the optimal way to integrate these both, but for us it works.

We configured all database connections via spring as DataSource, and these we use further on for the hibernate session factories and for the "old" avalon data sources as well. Neither the sql-transformer nor hibernate complained so long. But they get seperate data sources ;-), so why should they?

The access to hibernate managed java objects is done via the standard hibernate way: Getting a factory, getting a session, fetching/manipulating your object. We use a central class, a (scope=singleton) HibernateUtil, to get the connection to the different hibernate session factories. This Util class additionally offers some easy ways to fetch and delete objects without carying for all the session/transaction stuff. Handy if you need your hibernate objects in a flow script.

The cases with a bit more complex java objects we placed in own dao objects, which are accessed only via some service classes. Extra effort, yes, but very nice if it comes do transaction handling. AOP is worth a try here, and with spring and the descriptions they provide it works fine for us.

Regards

Søren


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to