stshiva raaj

+ Follow
since Sep 23, 2008
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by stshiva raaj

Hi Team,
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.

Thanks in advance
Team, My existing developers are set lazy="false" and worked lot. Now I am facing performance issue. It is fetching all child objects. Without changing my existing hbm files Is there any way to avoid lazy="false".
Team, I have some performance issues because of my existing hbm file. I enabled lazy="false" in most of the place. So, I am getting child objects and it is performance issue. Tell it is possible, Can i configure one hibernate.mapping.xml with duplicate copy of hbml file with lazy="true". If so, what are the thing i need to do and what are the impact i will face?

--->Having two hibernate.cfg.xml on the same project
SessionFactory sessionFactory1 = new Configuration().configure("oracleconfig.cfg.xml").buildSessionFactory();
Session webSession=sessionFactory2.getCurrentSession();

SessionFactory sessionFactory2 = new Configuration().configure("oracleconfig_duplicate.cfg.xml").buildSessionFactory();
Session webServiceSession=sessionFactory2.getCurrentSession();
My hibernate configuration looks recursive map.

Device dev=new Device();
//--- setDevId();

Dummy dum=new Dummy();

session.flush();// Getting exception state state object

The db design is,
Device (1) --- Dummy(M)(Bag)

Dummy 1 --- Device 1

My problem is , when i save the pojo i faced this problem. Is there any way to solve this problem?
Will HibernateSessioFactory.getCurrentSession() after the transaction commits automatically close the current session? So I can not use session instance after commit. Correct ?
I used a single session per thread request. I have transaction open and commit. Correct me If I wrong "getCurrentSession and openSession need to close the session by us" right?. For both I used code to explicitly close the session using HibernateSessionFactory.closeSession(). Does Hibernate close the session automatically?
Thanks for your reply.I am going to ask final question.

If session.invalidate() -- session is null
If session has been expired -- session instance is not null right?

If not null means, How can I check the session has been expired or not?
10 years ago
Thanks. Are you sure after session has been expired sessionDestroyed()will call right?
10 years ago
Thanks Armitage, Actually my question is, even session time out happen why session instance is not null. Using session instance i can access some session properties. Is there any API to find the session time out without help of HttpSessionListener
10 years ago
Hi Team,
I faced one problem, I am not using transaction but I have accessed persistent object. When I am trying to close the session, the updated data is reflected into database. Will session.close() flush the persistent data even I have not used transaction?

Code :
ElanTaskFolder folder=(ElanTaskFolder )session.get(ElanTaskFolder.class, folderId);
folder.setStartDate(new Date());
//I am not used flush or commit here. Just accessed db object and set the date only
} catch(Exception e{

} finally{
HibernateSessionFactory.closeSession();// The startDate will reflect current Date and Time in database? Actually, the current date is reflected in database. How it possible?

My conclusion, even close() is going to flush the data into db If i modify the persistent object
Thanks Deniel. I understand but my question is going to be straight forward. How Can I find whether session is time out or invalidate?

If session is null - session is invalidated
if(session ==null)"Session is destroyed");

If session is not null but how to check time out or not
if(session !=null && ??)//??-how to check session is time out or"Session has been expired");

FYI : Even session has been time out,the session object is not null. Then how I find the session is expired or not?
10 years ago
Hi folks, Can I access the session object even session has been expired? I need to check whether session is expired or not for each request. How to check?
The session invalidation is set null the session object. What I concluded, session time out I can access session object but session invalidation I can not access session object. Am I correct? Then How can I find the
session time out by using session object?
10 years ago