-->
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: Record not updating
PostPosted: Tue May 13, 2008 8:44 am 
Newbie

Joined: Tue May 13, 2008 8:27 am
Posts: 1
Hi

I've this problem with Hibernate. The following lines of code are from an update() function:

Code:
Transaction tx = userDao.getSession().beginTransaction();
      AclUser user = (AclUser)userDao.findByProperty("username", userName).get(0);
      user.setFirstName("orm1212");
      userDao.save(user);
      tx.commit();


This code is not returning any error, however it's not doing what it's supposed to be doing, i.e persisting the change in firstname.

However the following code works!


Code:
Transaction tx = userDao.getSession().beginTransaction();
      AclUser user = (AclUser)userDao.findByProperty("username", "danielw").get(0);
      user.setFirstName("orm1212");
      userDao.save(user);
      tx.commit();


The only difference is line 2 where findByProperty() is called. I am no longer able to pass a parameter. This is kind of strange. I have tried my luck, so any help would be much appreciated.

Thanks


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.