public T insert(T t) throws ConstraintViolationException {
		
		if (t == null) {
			throw new IllegalArgumentException();
		}

		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		
		try {
			session.save(t);
			session.flush();
			session.getTransaction().commit();
		} catch (Exception e) {
			session.getTransaction().rollback();
			throw new HibernateException(e.getMessage());
		}

		return t;
	}
public T insert ( T t ) throws ConstraintViolationException { if ( t == null ) { throw new IllegalArgumentException ( ) ; } Session session = HibernateUtil . getSessionFactory ( ) . getCurrentSession ( ) ; session . beginTransaction ( ) ; try { session . save ( t ) ; session . flush ( ) ; session . getTransaction ( ) . commit ( ) ; } catch ( Exception e ) { session . getTransaction ( ) . rollback ( ) ; throw new HibernateException ( e . getMessage ( ) ) ; } return t ; }
persist a generic object

@param t type of object
@return inserted object
@throws ConstraintViolationException