This blog is dedicated to all Sri Lankan Java Students. You can use this blog to discuss whatever question you have related to Java. I might be able to answer your questions. Or some of you also can answer the questions If you like.
First of all I thanks to Mr.Sampath for initiative for this blog.
I have a question about Hibernate/Spring DAO integration. In our application, we use more than 200 domain and DAO (HibernateDaoSupport ) classes with single hibernate session factory (multiple spring configuration files). I want to make sure is it ok use single session factory? Or should I use multiple session factories?
Creating a session factory is a very heavy operation. So normally we keep one session factory and create multiple sessions. Also it is not required to have one separate Dao for each domain object.
Thanks for the reply,As I understood, define hibernate session factory as singleton bean, and inject it to DAO it will create only one session factory and multiple session for each DAO, my question is having big number of domain classes mapped to single session factory will effect the performance of application ?
Higher the no of domain objects, it will affect the performance. But if you really need that much of domain objects you have to do it. But you can use some of the performance optimization methods like lazy loading,caching etc.
7 comments:
Nice piece of work.....
Hi All,
Please join me to congratulate Amila Shrimal on his new Job at Apturion as a Java Software Engineer
Regards
Sampath
Hi All,
First of all I thanks to Mr.Sampath for initiative for this blog.
I have a question about Hibernate/Spring DAO integration. In our application, we use more than 200 domain and DAO (HibernateDaoSupport ) classes with single hibernate session factory (multiple spring configuration files). I want to make sure is it ok use single session factory? Or should I use multiple session factories?
Regards
Nuwan
Creating a session factory is a very heavy operation. So normally we keep one session factory and create multiple sessions. Also it is not required to have one separate Dao for each domain object.
Thanks for the reply,As I understood, define hibernate session factory as singleton bean, and inject it to DAO it will create only one session factory and multiple session for each DAO, my question is having big number of domain classes mapped to single session factory will effect the performance of application ?
regards
Nuwan
Higher the no of domain objects, it will affect the performance. But if you really need that much of domain objects you have to do it. But you can use some of the performance optimization methods like lazy loading,caching etc.
Ok Thanks Sampath.
Post a Comment