-->
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.  [ 1 post ] 
Author Message
 Post subject: Update executed after commit on list()
PostPosted: Fri Apr 21, 2006 5:58 am 
Newbie

Joined: Tue Aug 09, 2005 4:01 am
Posts: 7
Problem:
Hibernate is executing an Update statement after a commit is called on a criteria.list()

Any ideas why this happens?

I call a commit since the code inside the try can change to a saveOrUpdate() or delete().

Hibernate version:
Hibernate 3

Code between sessionFactory.openSession() and session.close():
try

......

session = HibernateUtils.currentSession();
HibernateUtils.beginTransaction();
if (criteria_collection != null) {
Criteria criteria = session.createCriteria(entityClass);

for (Criterion crit: criteria_collection) {
criteria.add(crit);
}

result = criteria.list();
} else {
result =
session.createQuery(" from " + entityClass.getName()).list();
}

.......

HibernateUtils.commitTransaction();
} catch (Throwable t) {
log.error("Unexpected error!", t);
HibernateUtils.rollbackTransaction();
} finally {
HibernateUtils.closeSession();
}

Name and version of the database you are using:
Oracle 10g

The generated SQL (show_sql=true):
06/04/21 12:14:57 Hibernate: select passwordpo0_.IDPASSWORDPOLICY as IDPASSWO1_0_, passwordpo0_.DCREATE as DCREATE0_, passwordpo0_.DMODIFY as DMODIFY0_, passwordpo0_.IDCREATEUSER as IDCREATE4_0_, passwordpo0_.IDMODIFYUSER as IDMODIFY5_0_, passwordpo0_.NEXPIREDAYS as NEXPIRED6_0_, passwordpo0_.NMINCHARS as NMINCHARS0_, passwordpo0_.SZALLOWEDLETTERS as SZALLOWE8_0_, passwordpo0_.NMINLETTERS as NMINLETT9_0_, passwordpo0_.SZALLOWEDDIGITS as SZALLOW10_0_, passwordpo0_.NMINDIGITS as NMINDIGITS0_, passwordpo0_.SZALLOWEDSYMBOLS as SZALLOW12_0_, passwordpo0_.NMINSYMBOLS as NMINSYM13_0_, passwordpo0_.SZUNALLOWEDPASSWORDS as SZUNALL14_0_, passwordpo0_.NALLOWEDATTEMPTS as NALLOWE15_0_, passwordpo0_.NOLDPASSWORDSCOUNT as NOLDPAS16_0_, passwordpo0_.NUNLOCKINMINUTES as NUNLOCK17_0_ from PASSWORDPOLICY passwordpo0_

06/04/21 12:14:57 Hibernate: update PASSWORDPOLICY set DCREATE=?, DMODIFY=?, IDCREATEUSER=?, IDMODIFYUSER=?, NEXPIREDAYS=?, NMINCHARS=?, SZALLOWEDLETTERS=?, NMINLETTERS=?, SZALLOWEDDIGITS=?, NMINDIGITS=?, SZALLOWEDSYMBOLS=?, NMINSYMBOLS=?, SZUNALLOWEDPASSWORDS=?, NALLOWEDATTEMPTS=?, NOLDPASSWORDSCOUNT=?, NUNLOCKINMINUTES=? where IDPASSWORDPOLICY=?

_________________
Regards,
Alexander Kamburov

wise_guybg at yahoo.com


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

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.