-->
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: problems with update
PostPosted: Mon Jul 31, 2006 7:14 am 
Beginner
Beginner

Joined: Thu Jun 22, 2006 8:56 am
Posts: 22
Hello,

i dont know why my update does not work:
Code:
Integer nr = 5;
Query query = session.createQuery("from Source as source where source.nr = '"+ nr + "' " );
Source found_final =(Source)query.uniqueResult();
if (found_final == null){
found = new Source(source);
session.save(found);
}
                   
else{   
session.saveOrUpdate(found_final);
}


Can anyoune help?

Thank you,
seven-12


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 9:55 am 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
Why do you want to call saveOrUpdate in the else when nothing has changed on found_final object. Try changing property values in found_final object and then invoke saveOrUpdate, you should see an update happening.


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.