-->
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: Hibernate apparently repeating a single query 7+ times
PostPosted: Tue Jul 24, 2007 2:20 pm 
Newbie

Joined: Tue Jul 24, 2007 2:11 pm
Posts: 2
Update: I believe this is due to the object being recreated everytime it's referenced in the view. I thought when an object is referenced the first time it's created, and should stay alive in that session. Should I be setting a particular ScopeType or setting somewhere to stop this from happening?
----

I've been migrating a seam/hibernate app that used to use a MSSQL database in windows, over to linux and oracle.

For some reason after the switch to linux and oracle, the queries executed are being repeated over and over again in the JBoss log. It happened a little in windows as well, but it's gotten much worse in linux with oracle.

For instance, one view loads an object with 4 fields that's mapped to a table. There's one query that loads the object and displays it in a view. Yet the jboss log shows the INFO [STDOUT] Hibernate: <query here> executing 7 or more times.

Is there a reason for this? Is it really executing it that many times, or just relaying it that many times? Can someone point me in the right direction?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 25, 2007 4:54 am 
Regular
Regular

Joined: Fri May 12, 2006 4:05 am
Posts: 106
How are you retrieving your object?
When using get() or load() to retrieve the object via its id-field it should be loaded from the DB only once.
If you retrieve it by querying some other (non-id-)field the query will be executed each time because the persistence-context doesn#t know about query-results, only about entities and their ids.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 25, 2007 8:17 am 
Newbie

Joined: Tue Jul 24, 2007 2:11 pm
Posts: 2
This is actually in a xhtml view using JSF and seam tags. So I'm referencing fields like #{ObjectName.field} in the xhtml.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.