Code example for Session

Methods: createCriteria

0
tx = session.beginTransaction();
	} 
	@SuppressWarnings("unchecked") 
	protected <T> T find(Class<T> entityClass, Serializable id) {
		Criteria c = session.createCriteria(entityClass);
		c.add(Restrictions.idEq(id));
		return (T)c.uniqueResult();
	} 
	@SuppressWarnings("unchecked") 
	protected <T> T save(T entity) {
		return (T)session.merge(entity);
	} 
	protected <T> void remove(T entity) {
		session.delete(entity);
	} 
	protected void flush() { 
		flush(true); 
	} 
	protected void flush(boolean commit) {
Contextual code suggestions in your IDE  Get Codota for Java