Hibernate performance issue - single sesson for whole proces
posted 2 years ago
I need clarificaton about my applicatio performance. I am using spring and hibernate. Before my application was,
most of the <bag> collections are lazy=false, @ManyToMany as default fetch(fetch=select) and using a session per service layer request(per each reqeust created a session - 500 times).
The child elements are not required very first time while fetching the record. That time, it takes 3 minutes to complete all process.
Now, I have changed the architecture with all <bag> collection are lazy=true, @ManyToMany as fetch=join and single session for whole process. Now, it takes 20 minutes
to complete all process. I don't know, what is happen...
Also, I have set hibernate_jdbc_fetch_size as 50.
I am doubting,
1. Due to single session it cause the issue(become heavy weight object)
2. fetch=join is causing the issue
Please suggest me, Is there any more tune up configuration I need to do in hibernate level.