public void remove(Object entity) { checkTransactionNeeded(); try { getSession().delete( entity ); } catch ( MappingException e ) { throw new IllegalArgumentException( e.getMessage(), e ); } catch ( RuntimeException e ) { //including HibernateException throw convert( e ); } }
public void remove(Object entity) { checkTransactionNeeded(); //adjustFlushMode(); try { getSession().delete( entity ); } catch (MappingException e) { throw new IllegalArgumentException( e.getMessage(), e ); } catch (HibernateException he) { throwPersistenceException( he ); } }
@SuppressWarnings("unchecked") public <A> A merge(A entity) { checkTransactionNeeded(); try { return ( A ) getSession().merge( entity ); } catch ( ObjectDeletedException sse ) { throw new IllegalArgumentException( sse ); } catch ( MappingException e ) { throw new IllegalArgumentException( e.getMessage(), e ); } catch ( RuntimeException e ) { //including HibernateException throw convert( e ); } }
public void persist(Object entity) { checkTransactionNeeded(); try { getSession().persist( entity ); } catch ( MappingException e ) { throw new IllegalArgumentException( e.getMessage() ); } catch ( RuntimeException e ) { throw convert( e ); } }
public void persist(Object entity) { checkTransactionNeeded(); //adjustFlushMode(); try { getSession().persist( entity ); } catch (MappingException e) { throw new IllegalArgumentException( e.getMessage() ); } catch (HibernateException he) { throwPersistenceException( he ); } }
public void persist(Object entity) { checkTransactionNeeded(); //adjustFlushMode(); try { getSession().persist( entity ); } catch (MappingException e) { throw new IllegalArgumentException( e.getMessage() ); } catch (HibernateException he) { throwPersistenceException( he ); } }
@SuppressWarnings("unchecked") public <A> A merge(A entity) { checkTransactionNeeded(); //adjustFlushMode(); try { return (A) getSession().merge( entity ); } catch (ObjectDeletedException sse) { throw new IllegalArgumentException( sse ); } catch (MappingException e) { throw new IllegalArgumentException( e.getMessage(), e ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
@SuppressWarnings("unchecked") public <A> A merge(A entity) { checkTransactionNeeded(); //adjustFlushMode(); try { return (A) getSession().merge( entity ); } catch (ObjectDeletedException sse) { throw new IllegalArgumentException( sse ); } catch (MappingException e) { throw new IllegalArgumentException( e.getMessage(), e ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
public void refresh(Object entity) { checkTransactionNeeded(); //adjustFlushMode(); try { if ( ! getSession().contains( entity ) ) { throw new IllegalArgumentException( "Entity not managed" ); } getSession().refresh( entity ); } catch (MappingException e) { throw new IllegalArgumentException( e.getMessage(), e ); } catch (HibernateException he) { throwPersistenceException( he ); } }
public void refresh(Object entity, LockModeType lockModeType, Map<String, Object> properties) { checkTransactionNeeded(); CacheMode previousCacheMode = getSession().getCacheMode(); CacheMode localCacheMode = determineAppropriateLocalCacheMode( properties ); LockOptions lockOptions = null; try { getSession().setCacheMode( localCacheMode ); if ( !getSession().contains( entity ) ) { throw new IllegalArgumentException( "Entity not managed" ); } if ( lockModeType != null ) { getSession().refresh( entity, ( lockOptions = getLockRequest( lockModeType, properties ) ) ); } else { getSession().refresh( entity ); } } catch ( MappingException e ) { throw new IllegalArgumentException( e.getMessage(), e ); } catch ( HibernateException he ) { throw convert( he, lockOptions ); } finally { getSession().setCacheMode( previousCacheMode ); } }