-->
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.  [ 6 posts ] 
Author Message
 Post subject: SELECT operations also does some UPDATE operations... why???
PostPosted: Tue Mar 04, 2008 9:39 am 
Newbie

Joined: Wed Feb 06, 2008 10:06 am
Posts: 14
Hi there,
I am having a little problem with Hibernate.

At several points in my application, when i load some data from my entities, via Hibernate, i get a lot of "UPDATE ...." logs.
And i really don't understand this behavior, since i am really only doing SELECT operations (load, findBy, get...)`

Any idea?
Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 11:08 am 
Regular
Regular

Joined: Tue Mar 22, 2005 2:27 am
Posts: 62
Are you perhaps manipulating or modifying the returned model object (POJO) within the scope of the open Session/Transaction?
If so, that would explain it...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 11:11 am 
Regular
Regular

Joined: Tue Mar 22, 2005 2:27 am
Posts: 62
http://www.hibernate.org/hib_docs/v3/re ... -modifying


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 11:19 am 
Newbie

Joined: Wed Feb 06, 2008 10:06 am
Posts: 14
Thanks for the advice
I will double-check again but i am pretty sure i dont have any set operations in my method call (when i saw all this update operation,s this was the first idea that came to my mind...)
But i'm gonna check again.
Nico.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 8:44 am 
Newbie

Joined: Wed Feb 06, 2008 10:06 am
Posts: 14
I just came back to this problem since i had something more prioritary to deal with. Anyway.

Just enabled the debug mode + Hibernate SQL logs.

I found out that the update operations are laucnhed upon queryObject.list() method in the following code (this code is in RegularityFormDaoBase, RegularityForm being the entity. It is an AndroMDA-generated base class, i based upon this to implement business methods)

Code:
public java.lang.Object findByEffectiveTranche(final int transform, final java.lang.String queryString, final com.thalys.opalys.domain.EffectiveTranche effectiveTranche)
    {
        try
        {
            org.hibernate.Query queryObject = super.getSession(false).createQuery(queryString);
            queryObject.setParameter("effectiveTranche", effectiveTranche);
            java.util.Set results = new java.util.LinkedHashSet(queryObject.list());
            java.lang.Object result = null;
            if (results != null)
            {
                if (results.size() > 1)
                {
                    throw new org.springframework.dao.InvalidDataAccessResourceUsageException(
                        "More than one instance of 'com.thalys.opalys.domain.RegularityForm"
                            + "' was found when executing query --> '" + queryString + "'");
                }
                else if (results.size() == 1)
                {
                    result = results.iterator().next();
                }
            }
            result = transformEntity(transform, (com.thalys.opalys.domain.RegularityForm)result);
            return result;
        }
        catch (org.hibernate.HibernateException ex)
        {
            throw super.convertHibernateAccessException(ex);
        }
    }


Before passing by this line i have this last two log lines:
Code:
13:40:30,563 INFO  [STDOUT] Hibernate: select effectivep0_.EFFECTIVE_TRANCHE_FK as EFFECTIVE26_1_, effectivep0_.ID as ID1_, effectivep0_.ID as ID14_0_, effectivep0_.PASSAGE_EFFECTIVE as PASSAGE2_14_0_, effectivep0_.THEORETICAL_COMPOSITION as THEORETI3_14_0_, effectivep0_.EFFECTIVE_COMPOSITION as EFFECTIVE4_14_0_, effectivep0_.THEORETICAL_DATE as THEORETI5_14_0_, effectivep0_.EFFECTIVE_DATE as EFFECTIVE6_14_0_, effectivep0_.PASSENGERS_UP_FIRST_CLASS as PASSENGERS7_14_0_, effectivep0_.PASSENGERS_UP_SECOND_CLASS as PASSENGERS8_14_0_, effectivep0_.PASSENGERS_DOWN_FIRST_CLASS as PASSENGERS9_14_0_, effectivep0_.PASSENGERS_DOWN_SECOND_CLASS as PASSENGERS10_14_0_, effectivep0_.PASSENGERS_STILL_FIRST_CLASS as PASSENGERS11_14_0_, effectivep0_.PASSENGERS_STILL_SECOND_CLASS as PASSENGERS12_14_0_, effectivep0_.DELAY as DELAY14_0_, effectivep0_.COMMERCIAL_INCIDENT_DESCRIPTIO as COMMERCIAL14_14_0_, effectivep0_.IS_COMPENSABLE as IS15_14_0_, effectivep0_.IS_EXTERNAL_FACTOR as IS16_14_0_, effectivep0_.COMPENSATION_PERCENTAGE as COMPENS17_14_0_, effectivep0_.TOTAL_IMPUTATION as TOTAL18_14_0_, effectivep0_.END_OF_MISSION_INFO_PRESENT as END19_14_0_, effectivep0_.STATION_TYPE as STATION20_14_0_, effectivep0_.POINT_FK as POINT21_14_0_, effectivep0_.THEORETICAL_LINKED_TRANCHE_FK as THEORET22_14_0_, effectivep0_.TRAIN_SET_FK as TRAIN23_14_0_, effectivep0_.EFFECTIVE_LINKED_TRANCHE_FK as EFFECTIVE24_14_0_, effectivep0_.COMMERCIAL_INCIDENT_TYPE_FK as COMMERCIAL25_14_0_ from EFFECTIVE_PASSAGE effectivep0_ where effectivep0_.EFFECTIVE_TRANCHE_FK=? order by effectivep0_.EFFECTIVE_TRANCHE_FK
13:40:30,567 INFO  [STDOUT] Hibernate: select incidentef0_.AFFECTED_TRANCHE_FK as AFFECTED8_1_, incidentef0_.ID as ID1_, incidentef0_.ID as ID22_0_, incidentef0_.DELAY as DELAY22_0_, incidentef0_.COMMENTS as COMMENTS22_0_, incidentef0_.TYPE as TYPE22_0_, incidentef0_.DATE as DATE22_0_, incidentef0_.INCIDENT_EFFECT_LINK as INCIDENT6_22_0_, incidentef0_.TRIGGERING_INCIDENT_FK as TRIGGERING7_22_0_, incidentef0_.AFFECTED_TRANCHE_FK as AFFECTED8_22_0_, incidentef0_.BEGIN_POINT_FK as BEGIN9_22_0_, incidentef0_.END_POINT_FK as END10_22_0_, incidentef0_.CUSTOMER_LINKED_TRANCHE_FK as CUSTOMER11_22_0_, incidentef0_.INCIDENT_TYPE_FK as INCIDENT12_22_0_ from EFFECT incidentef0_ where incidentef0_.AFFECTED_TRANCHE_FK=? order by incidentef0_.AFFECTED_TRANCHE_FK


Once i pass by the line queryObject.list(), i get the following log
Code:
13:40:30,563 INFO  [STDOUT] Hibernate: select effectivep0_.EFFECTIVE_TRANCHE_FK as EFFECTIVE26_1_, effectivep0_.ID as ID1_, effectivep0_.ID as ID14_0_, effectivep0_.PASSAGE_EFFECTIVE as PASSAGE2_14_0_, effectivep0_.THEORETICAL_COMPOSITION as THEORETI3_14_0_, effectivep0_.EFFECTIVE_COMPOSITION as EFFECTIVE4_14_0_, effectivep0_.THEORETICAL_DATE as THEORETI5_14_0_, effectivep0_.EFFECTIVE_DATE as EFFECTIVE6_14_0_, effectivep0_.PASSENGERS_UP_FIRST_CLASS as PASSENGERS7_14_0_, effectivep0_.PASSENGERS_UP_SECOND_CLASS as PASSENGERS8_14_0_, effectivep0_.PASSENGERS_DOWN_FIRST_CLASS as PASSENGERS9_14_0_, effectivep0_.PASSENGERS_DOWN_SECOND_CLASS as PASSENGERS10_14_0_, effectivep0_.PASSENGERS_STILL_FIRST_CLASS as PASSENGERS11_14_0_, effectivep0_.PASSENGERS_STILL_SECOND_CLASS as PASSENGERS12_14_0_, effectivep0_.DELAY as DELAY14_0_, effectivep0_.COMMERCIAL_INCIDENT_DESCRIPTIO as COMMERCIAL14_14_0_, effectivep0_.IS_COMPENSABLE as IS15_14_0_, effectivep0_.IS_EXTERNAL_FACTOR as IS16_14_0_, effectivep0_.COMPENSATION_PERCENTAGE as COMPENS17_14_0_, effectivep0_.TOTAL_IMPUTATION as TOTAL18_14_0_, effectivep0_.END_OF_MISSION_INFO_PRESENT as END19_14_0_, effectivep0_.STATION_TYPE as STATION20_14_0_, effectivep0_.POINT_FK as POINT21_14_0_, effectivep0_.THEORETICAL_LINKED_TRANCHE_FK as THEORET22_14_0_, effectivep0_.TRAIN_SET_FK as TRAIN23_14_0_, effectivep0_.EFFECTIVE_LINKED_TRANCHE_FK as EFFECTIVE24_14_0_, effectivep0_.COMMERCIAL_INCIDENT_TYPE_FK as COMMERCIAL25_14_0_ from EFFECTIVE_PASSAGE effectivep0_ where effectivep0_.EFFECTIVE_TRANCHE_FK=? order by effectivep0_.EFFECTIVE_TRANCHE_FK
13:40:30,567 INFO  [STDOUT] Hibernate: select incidentef0_.AFFECTED_TRANCHE_FK as AFFECTED8_1_, incidentef0_.ID as ID1_, incidentef0_.ID as ID22_0_, incidentef0_.DELAY as DELAY22_0_, incidentef0_.COMMENTS as COMMENTS22_0_, incidentef0_.TYPE as TYPE22_0_, incidentef0_.DATE as DATE22_0_, incidentef0_.INCIDENT_EFFECT_LINK as INCIDENT6_22_0_, incidentef0_.TRIGGERING_INCIDENT_FK as TRIGGERING7_22_0_, incidentef0_.AFFECTED_TRANCHE_FK as AFFECTED8_22_0_, incidentef0_.BEGIN_POINT_FK as BEGIN9_22_0_, incidentef0_.END_POINT_FK as END10_22_0_, incidentef0_.CUSTOMER_LINKED_TRANCHE_FK as CUSTOMER11_22_0_, incidentef0_.INCIDENT_TYPE_FK as INCIDENT12_22_0_ from EFFECT incidentef0_ where incidentef0_.AFFECTED_TRANCHE_FK=? order by incidentef0_.AFFECTED_TRANCHE_FK
13:40:35,172 INFO  [STDOUT] Hibernate: update REGULARITY_FORM set NUMBER=?, CREATION_DATE=?, COMPLEMENTARY_INFORMATION=?, CUSTOMER_SERVICE_INFORMATION=?, STATUS=?, LAST_VALIDATION_DATE=?, EFFECTIVE_TRANCHE_FK=? where ID=?
13:40:35,172 INFO  [STDOUT] Hibernate: update REGULARITY_FORM set NUMBER=?, CREATION_DATE=?, COMPLEMENTARY_INFORMATION=?, CUSTOMER_SERVICE_INFORMATION=?, STATUS=?, LAST_VALIDATION_DATE=?, EFFECTIVE_TRANCHE_FK=? where ID=?
13:40:35,172 INFO  [STDOUT] Hibernate: update REGULARITY_FORM set NUMBER=?, CREATION_DATE=?, COMPLEMENTARY_INFORMATION=?, CUSTOMER_SERVICE_INFORMATION=?, STATUS=?, LAST_VALIDATION_DATE=?, EFFECTIVE_TRANCHE_FK=? where ID=?
13:40:35,172 INFO  [STDOUT] Hibernate: update REGULARITY_FORM set NUMBER=?, CREATION_DATE=?, COMPLEMENTARY_INFORMATION=?, CUSTOMER_SERVICE_INFORMATION=?, STATUS=?, LAST_VALIDATION_DATE=?, EFFECTIVE_TRANCHE_FK=? where ID=?
13:40:35,173 INFO  [STDOUT] Hibernate: update REGULARITY_FORM set NUMBER=?, CREATION_DATE=?, COMPLEMENTARY_INFORMATION=?, CUSTOMER_SERVICE_INFORMATION=?, STATUS=?, LAST_VALIDATION_DATE=?, EFFECTIVE_TRANCHE_FK=? where ID=?
13:40:35,173 INFO  [STDOUT] Hibernate: update REGULARITY_FORM set NUMBER=?, CREATION_DATE=?, COMPLEMENTARY_INFORMATION=?, CUSTOMER_SERVICE_INFORMATION=?, STATUS=?, LAST_VALIDATION_DATE=?, EFFECTIVE_TRANCHE_FK=? where ID=?
13:40:35,176 INFO  [STDOUT] Hibernate: select regularity0_.ID as ID10_, regularity0_.NUMBER as NUMBER10_, regularity0_.CREATION_DATE as CREATION3_10_, regularity0_.COMPLEMENTARY_INFORMATION as COMPLEME4_10_, regularity0_.CUSTOMER_SERVICE_INFORMATION as CUSTOMER5_10_, regularity0_.STATUS as STATUS10_, regularity0_.LAST_VALIDATION_DATE as LAST7_10_, regularity0_.EFFECTIVE_TRANCHE_FK as EFFECTIVE8_10_ from REGULARITY_FORM regularity0_ where regularity0_.EFFECTIVE_TRANCHE_FK=?


Anyway, i don't see any setXXX()...

Any idea?
Thanks in advance.
(and sorry for tthe loooong logs, byt maybe u will see something i didn't notice!)


Top
 Profile  
 
 Post subject: Re: SELECT operations also does some UPDATE operations... why???
PostPosted: Thu Oct 14, 2010 3:20 pm 
Newbie

Joined: Thu Oct 14, 2010 3:17 pm
Posts: 1
Hi.. I have the some issue. Somebody know resolved?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.