-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Cascade operation performance tuning for Hibernate 5
PostPosted: Tue Nov 08, 2016 11:05 pm 
Newbie

Joined: Sat Oct 15, 2016 9:49 pm
Posts: 5
Hi,

I'm trying to track down a performance problem and profiling has led me to wonder what Cascade.cascade and CascadeAction.noCascade are doing. The application spends most of its time in these two methods. The application is only performing reads, so this seems counter intuitive to me.

I'm using hibernate 5.2.3 if that matters.

Thanks for any help.

Reid


Top
 Profile  
 
 Post subject: Re: Profiler shows most time spent in Cascade.cascade
PostPosted: Wed Nov 09, 2016 12:26 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
For read-only transactions, you need to fetch read-only entities so that the dirty checking mechanism does not fire.

For example, if the current Session only needs to fetch read-only entities, yu can set this flag:

Code:
session.setReadOnly(true);


or use a query hint:

Code:
List<Post> posts = entityManager.createQuery(
    "select p from Post p", Post.class)
.setHint("org.hibernate.readOnly", true)
.getResultList();


Top
 Profile  
 
 Post subject: Re: Cascade operation performance tuning for Hibernate 5
PostPosted: Wed Nov 09, 2016 1:02 pm 
Newbie

Joined: Sat Oct 15, 2016 9:49 pm
Posts: 5
Thank you so much! I'll give it a try.

Edit: Yes, that really helped. Making the transaction read only improved the query time by over 20x!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.