[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Hibernate loads all entities on manager.merge()

murtuza52 do-not-reply at jboss.com
Sun Dec 24 02:41:37 EST 2006


I found the culprit. For those who have performance related issue, this might be one of the reasons. The culprit here was the use of FetchType.EAGER. This might be because of "load-before-update" strategy hibernate uses to check the columns have changed. Over use of EAGER means its going to load every related entities in memory and therefore performance is effected.

Make all relations LAZY except for those that are absolutely required. You can easily debug and find out if the application server is working hard to synchronize with the database by using Use tags 
  |       <property name="hibernate.show_sql" value="true"/>
  |       <property name="hibernate.use_sql_comments" value="true"/>
  | 
 in persistence.xml file. This will show you what is happening in background and you can find out what entities get loaded will persisting or merging.

I hope hibernate or jboss comes up with better strategy to synchronize the data. This doesn't seems to be effecting the performance with server like GlassFish or JDO framework. They have different algorithm that performans more efficients.

Feedback are welcomed to improve the performance further.

Murtuza

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996091#3996091

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996091



More information about the jboss-user mailing list