Hibernate ORM Session - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM Session class.

This code example shows how to use the following methods: flush
 
	@Override 
	public void flush() { 
		try { 
			SessionFactoryUtils.logger.debug("Flushing Hibernate Session on explicit request"); 
			this.session.flush();
		} 
		catch (HibernateException ex) {
			throw SessionFactoryUtils.convertHibernateAccessException(ex);
		} 
	} 
 
 
	@Override 
	public boolean equals(Object obj) { 
		return (obj instanceof SpringFlushSynchronization &&
				this.session == ((SpringFlushSynchronization) obj).session);
	} 
 
	@Override 
Full Snippet Info
10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close
	 * @see org.hibernate.Session#close() 
	 */ 
	public static void closeSession(Session session) {
		if (session != null) {
			try { 
				session.close();
			} 
			catch (HibernateException ex) {
				logger.debug("Could not close Hibernate Session", ex);
			} 
			catch (Throwable ex) {
				logger.debug("Unexpected exception on closing Hibernate Session", ex);
			} 
		} 
	} 
 
	/** 
	 * Convert the given HibernateException to an appropriate exception 
	 * from the {@code org.springframework.dao} hierarchy. 
	 * @param ex HibernateException that occurred 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: persist
        log.info("Registering " + member.getName());
        // em.persist(member); 
 
        // using Hibernate session(Native API) and JPA entitymanager 
        Session session = (Session) em.getDelegate();
        session.persist(member);
        memberEventSrc.fire(member);
    } 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: delete
		return entity;
	} 
	 
	public void delete(T entity) {
		Session session = PersistContext.getSession(isCloudStackSession);
		session.delete(entity);
	} 
	 
	public T queryEntity(String hql, Object[] params) {
		Session session = PersistContext.getSession(isCloudStackSession);
		Query query = session.createQuery(hql);
		query.setMaxResults(1);
		QueryHelper.bindParameters(query, params);
		return (T)query.uniqueResult();
	} 
	 
	public List<T> queryEntities(String hql, Object[] params) {
		Session session = PersistContext.getSession(isCloudStackSession);
		Query query = session.createQuery(hql);
		QueryHelper.bindParameters(query, params);
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: flush
	 * @throws HibernateException in case of Hibernate flushing errors 
	 */ 
	protected void flushIfNecessary(Session session, boolean existingTransaction) throws HibernateException { 
		if (getFlushMode() == FLUSH_EAGER || (!existingTransaction && getFlushMode() != FLUSH_NEVER)) { 
			logger.debug("Eagerly flushing Hibernate session"); 
			session.flush(); 
		} 
	} 
 
 
	/** 
	 * Convert the given HibernateException to an appropriate exception 
	 * from the {@code org.springframework.dao} hierarchy. 
	 * <p>Will automatically apply a specified SQLExceptionTranslator to a 
	 * Hibernate JDBCException, else rely on Hibernate's default translation. 
	 * @param ex HibernateException that occured 
	 * @return a corresponding DataAccessException 
	 * @see SessionFactoryUtils#convertHibernateAccessException 
	 * @see #setJdbcExceptionTranslator 
	 */ 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Hibernate ORM Session Methods: