-->
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: Object changes not persisted to database
PostPosted: Fri Jun 08, 2007 7:44 am 
Newbie

Joined: Tue Jul 27, 2004 1:33 pm
Posts: 18
Location: South Africa
hi all,

I am doing something quiet straight forward but it doesn work. I get a persistent object from a session. Then I close the session hand the object over to the front-end. Some changes are made on the front-end and the object is sent back. I then open a new session and do a saveOrUpdate.

There are no failure notices but the object does not get persist to the database. This is where I get the object

Session session = this.getSession();
Query query = session.createQuery("from user u where u.Username like :username ");
query.setString("username",userId);
if (query.list().size()==0) {
session.close();
return null;
}
User user = (User)query.list().get(0);
session.close();
return user;

When I try and save the object:

Session session = this.getSession();
session.saveOrUpdate(user);
session.flush();
session.close();

I tried

Session session = this.getSession();
session.merge(user);
session.saveOrUpdate(user);
session.flush();
session.close();

This doesn work either. It is only this one object I have this problem with. Others work fine. :(

_________________
http://www.jumpingbean.co.za
http://www.cyberconnect.co.za
http://www.ip-pbx.co.za
http://www.learndrupal.co.za


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 8:25 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
what's the log saying. Usually a good explanation in there

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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.