|
From: dosapati <dos...@ge...> - 2003-10-06 17:02:48
|
Hi, I read the article on 'Data Access with the Spring Framework' at hibernate.org. Can we completely eliminate Hibernate SessionFactory and Session usage in my classes[ProductDaoImpl in the article] using AOP interceptors. If I want to use Sun-JDO implementation in place of Hibernate as persistence manger. How many changes do I need to make to the ProductDaoImpl class? Before reading this article I wrote a wrapper class which will have save(), update(), delete() which in turn calls actual Hibernate Session to save, update and delete the passed objects respectively. And also the wrapper class have a method load(), which will call Session.load(Class, ID) to load the object. In my entity class I'll make calls to the above wrapper class. This way I am avoiding the direct dependency on Hibernate in my entity classes. The wrapper class has a method to create Session object and stores it in ThreadLocal. So that all the next requests will use the stored Session object. And the wrapper class has a method to close the Session object. But everytime I need to make these calls createSession() and closeSession() of Wrapper class to start a Session and close the session in a transaction. Can this be decalrativley achieved using Spring Framework. Thanks in advance! Dosapati |