-->
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: Why refresh() doesn´t work after an insert?
PostPosted: Mon Feb 11, 2008 10:01 am 
Newbie

Joined: Thu Jan 17, 2008 11:27 am
Posts: 4
Hello!

I was trying to refresh a transient object after an insert (a new db entry) and it did not work. Could anybody tell me why it doesn´t work for me?

I´m working in a Web Application with Spring and I need to handle the last inserted object in another page.

I have following code:

Code:
public class GenericDao extends HibernateDaoSupport {
...
    public void save(Object obj) {
        getHibernateTemplate().saveOrUpdate(obj);
        getHibernateTemplate().flush();
        getHibernateTemplate().refresh(obj);
    }
...
}


The execution of this code throws following Exception:

org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException: No row with the given identifier exists: [model.Workstep#0]; nested exception is org.hibernate.UnresolvableObjectException: No row with the given identifier exists: [model.Workstep#0]
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:642)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:377)
org.springframework.orm.hibernate3.HibernateTemplate.refresh(HibernateTemplate.java:557)
org.springframework.orm.hibernate3.HibernateTemplate.refresh(HibernateTemplate.java:553)

Does anybody know how to solve it?

Best Regards

Wagner


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.