Package oracle.toplink.essentials.sessions

Examples of oracle.toplink.essentials.sessions.UnitOfWork


    super.beginTransaction(entityManager, definition);
    if (!definition.isReadOnly() && !this.lazyDatabaseTransaction) {
      // This is the magic bit. As with the existing Spring TopLink integration,
      // begin an early transaction to force TopLink to get a JDBC Connection
      // so that Spring can manage transactions with JDBC as well as TopLink.
      UnitOfWork uow = (UnitOfWork) getSession(entityManager);
      uow.beginEarlyTransaction();
    }
    // Could return the UOW, if there were any advantage in having it later.
    return null;
  }
View Full Code Here


    super.beginTransaction(entityManager, definition);
    if (!definition.isReadOnly() && !this.lazyDatabaseTransaction) {
      // This is the magic bit. As with the existing Spring TopLink integration,
      // begin an early transaction to force TopLink to get a JDBC connection
      // so that Spring can manage transactions with JDBC as well as TopLink.
      UnitOfWork uow = (UnitOfWork) getSession(entityManager);
      uow.beginEarlyTransaction();
    }
    // Could return the UOW, if there were any advantage in having it later.
    return null;
  }
View Full Code Here

  * @param entity
  */
  public void refresh(Object entity){
        try {
            verifyOpen();
            UnitOfWork uow = getActivePersistenceContext(checkForTransaction(!isExtended()));
            if(!contains(entity, uow)) {
                throw new IllegalArgumentException(ExceptionLocalization.buildMessage("cant_refresh_not_managed_object", new Object[]{entity}));
            }
            ReadObjectQuery query = new ReadObjectQuery();
            query.setSelectionObject(entity);
            query.refreshIdentityMapResult();
            query.cascadeByMapping();
            query.setLockMode(ObjectBuildingQuery.NO_LOCK);
            Object refreshedEntity = null;
            refreshedEntity = uow.executeQuery(query);
            if(refreshedEntity == null) {
                //bug3323, should also invalidate the shared cached object if object not exists in DB.
                uow.getParent().getIdentityMapAccessor().invalidateObject(entity);
                throw new EntityNotFoundException(ExceptionLocalization.buildMessage("entity_no_longer_exists_in_db", new Object[]{entity}));
            }
        } catch (RuntimeException e) {
            this.setRollbackOnly();
            throw e;
View Full Code Here

TOP

Related Classes of oracle.toplink.essentials.sessions.UnitOfWork

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.