-->
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.  [ 2 posts ] 
Author Message
 Post subject: generated SQL question
PostPosted: Sat Jul 14, 2007 1:54 am 
Newbie

Joined: Sat Jul 14, 2007 1:41 am
Posts: 6
I am doing the simple property change on my persistent object. The object itself is retrieved by session.load() . I would expect that only the 'update' SQL query would be generated by Hibernate. Instead, I see the 'select' query first that corresponds to loading the object and then 'update'.

Is this normal behavior? If yes, that does not seem to be optimal. Or, what am I possibly doing wrong?

This is the code fragment:

try {
tx = session.beginTransaction();

Artist a = (Artist) session.load(Artist.class, 1);
a.setHometown("London");

tx.commit();
}
catch(Exception e) {
if (tx!=null) tx.rollback();
throw e;
}

Thank you!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 11:12 am 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
That's normal. This section of the manual will shed some light, I think:
http://www.hibernate.org/hib_docs/v3/re ... -modifying

-Chris

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


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