tags:

views:

196

answers:

1

Hi I am using Hibernate 3.0

Facing some issue with data saving.

in below code client is pojo that i want to save. Even though i tried to flush still same problem

try {
            getHibernateTemplate().saveOrUpdate(client);
            System.out.println("This is executed");
            getHibernateTemplate().getSessionFactory().getCurrentSession().flush();
        } catch (DataAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (HibernateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 

Getting Following Exception

org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
    at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63)
    at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:574)
    at com.hewitt.appinv.dao.ClientDAOImpl.saveClient(ClientDAOImpl.java:118)
A: 

Actually, I have some experience in nhibernate, not uin hibernate, but perhaps you should flush.

Daniel Dolz