public Object doHibernate(HibernateCallback action) throws Exception {

		Session session = sessionProvider.getSession();
		try {
			Object result = action.execute(session);
			return result;
		} catch (Exception ex) {
			logger.error("exception while execute", ex);
			try {
				sessionProvider.rollback();
			} catch (HibernateException ee) {
				logger.error("error while session rollback", ee);
			} finally {
				sessionProvider.resetSession();
			}
			throw new Exception(ex);

		} finally {
			// sessionProvider.returnCloseSession(session);
		}
	}
public Object doHibernate ( HibernateCallback action ) throws Exception { Session session = sessionProvider . getSession ( ) ; try { Object result = action . execute ( session ) ; return result ; } catch ( Exception ex ) { logger . error ( "exception while execute" , ex ) ; try { sessionProvider . rollback ( ) ; } catch ( HibernateException ee ) { logger . error ( "error while session rollback" , ee ) ; } finally { sessionProvider . resetSession ( ) ; } throw new Exception ( ex ) ; } finally { } }
Execute the action specified by the given action object within a Session.

@param action
callback object that specifies the Hibernate action
@param exposeNativeSession
whether to expose the native Hibernate Session to callback
code
@return a result object returned by the action, or <code>null</code>
@throws org.springframework.dao.Exception
in case of Hibernate errors