|
From: Cameron B. <ca...@da...> - 2003-10-27 11:51:24
|
I am just beginning to use the Spring framework, and so far I am very impressed. One thing that I don't quite understand is the mandatory requirement for each DAO and BO (Business Object) to support the set/getSessionFactory method. The reason that I say it is mandatory is because the only way to obtain the current session (as far as I know) is to use SessionFactoryUtils.getSession(SessionFactory...). This means that each DAO/BO requires a setSessionFactory property to be able to be passed it from the spring container. This also requires that each DAO/BO to be configured to bind the SessionFactory instance within the applicationContext.xml What I would think would be a simple and quite common use case would be for an app to require only one session factory. Therefore I think that the SessionFactoryUtils, and related classes , could use a static field to store the 'default' session factory. Has something like this been considered ? Do you think that this is a good or a bad idea ? Cheers, Cameron. |