Example usage for org.hibernate Session persist

List of usage examples for org.hibernate Session persist

Introduction

In this page you can find the example usage for org.hibernate Session persist.

Prototype

void persist(String entityName, Object object);

Source Link

Document

Make a transient instance persistent.

Usage

From source file:com.jdon.persistence.hibernate.HibernateTemplate.java

License:Apache License

public void persist(final String entityName, final Object entity) throws Exception {
    doHibernate(new HibernateCallback() {
        public Object execute(Session session) throws HibernateException {
            session.persist(entityName, entity);
            return null;
        }/*from w  w w  .  ja v  a  2 s.  c o  m*/
    });
}

From source file:org.opengoss.dao.hibernate.DataAccessor.java

License:Apache License

public void persist(final String entityName, final Object entity) throws DaoException {
    execute(new IAccessorCallback() {
        public Object call(Session session) throws HibernateException {
            session.persist(entityName, entity);
            return null;
        }/*w  w  w. j a  va 2 s .  com*/
    });
}

From source file:org.springframework.orm.hibernate3.HibernateTemplate.java

License:Apache License

@Override
public void persist(final String entityName, final Object entity) throws DataAccessException {
    executeWithNativeSession(new HibernateCallback<Object>() {
        @Override/*from  w w w. j av  a  2 s  .c o  m*/
        public Object doInHibernate(Session session) throws HibernateException {
            checkWriteOperationAllowed(session);
            session.persist(entityName, entity);
            return null;
        }
    });
}

From source file:org.springframework.orm.hibernate3.StatelessHibernateTemplate.java

License:Apache License

public void persist(final String entityName, final Object entity) throws DataAccessException {
    execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            checkWriteOperationAllowed(session);
            session.persist(entityName, entity);
            return null;
        }/*from w w w.j  av a 2s.  c o m*/
    }, true);
}