@Override public final Query createNamedQuery(String name) { checkClosed(); checkTransactionNeeded(); return getPersistenceDelegator().createQuery(name); }
@Override public final Query createNativeQuery(String sqlString, Class resultClass) { checkClosed(); checkTransactionNeeded(); return getPersistenceDelegator().createNativeQuery(sqlString, resultClass); }
@Override public final Query createQuery(String query) { checkClosed(); checkTransactionNeeded(); return getPersistenceDelegator().createQuery(query); }
/** * Refresh the state of the instance from the database, overwriting changes * made to the entity, if any. * * @param entity * @throws IllegalArgumentException * if the instance is not an entity or the entity is not managed * @throws TransactionRequiredException * if invoked on a container-managed entity manager of type * PersistenceContextType.TRANSACTION and there is no * transaction * @throws EntityNotFoundException * if the entity no longer exists in the database * @see javax.persistence.EntityManager#refresh(java.lang.Object) */ @Override public final void refresh(Object entity) { checkClosed(); checkTransactionNeeded(); getPersistenceDelegator().refresh(entity); }
/** * Find by primary key. Search for an entity of the specified class and * primary key. If the entity instance is contained in the persistence * context it is returned from there. * * @param entityClass * @param primaryKey * @return the found entity instance or null if the entity does not exist * @throws IllegalArgumentException * if the first argument does not denote an entity type or the * second argument is is not a valid type for that entity’s * primary key or is null * @see javax.persistence.EntityManager#find(java.lang.Class, * java.lang.Object) */ @Override public final <E> E find(Class<E> entityClass, Object primaryKey) { checkClosed(); checkTransactionNeeded(); return getPersistenceDelegator().findById(entityClass, primaryKey); }
/** * Remove the entity instance. * * @param entity * @throws IllegalArgumentException * if the instance is not an entity or is a detached entity * @throws TransactionRequiredException * if invoked on a container-managed entity manager of type * PersistenceContextType.TRANSACTION and there is no * transaction */ @Override public final void remove(Object e) { checkClosed(); checkTransactionNeeded(); try { getPersistenceDelegator().remove(e); } catch (Exception ex) { // on rollback. doRollback(); throw new KunderaException(ex); } }
/** * Merge the state of the given entity into the current persistence context. * * @param entity * @return the managed instance that the state was merged to * @throws IllegalArgumentException * if instance is not an entity or is a removed entity * @throws TransactionRequiredException * if invoked on a container-managed entity manager of type * PersistenceContextType.TRANSACTION and there is no * transaction * @see javax.persistence.EntityManager#merge(java.lang.Object) */ @Override public final <E> E merge(E e) { checkClosed(); checkTransactionNeeded(); try { return getPersistenceDelegator().merge(e); } catch (Exception ex) { // on Rollback doRollback(); throw new KunderaException(ex); } }