Package javax.persistence

Examples of javax.persistence.EntityExistsException


            sce.getElements().add("Resource name");
            throw sce;
        }

        if (resourceDAO.find(resourceTO.getName()) != null) {
            throw new EntityExistsException("Resource '" + resourceTO.getName() + "'");
        }

        ExternalResource resource = resourceDAO.save(binder.create(resourceTO));

        return binder.getResourceTO(resource);
View Full Code Here


      final EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof org.hibernate.NonUniqueObjectException ) {
      final EntityExistsException converted = new EntityExistsException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
        }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
      final NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
View Full Code Here

      PersistenceException converted = wrapLockException( (HibernateException) e, null );
      throwPersistenceException( converted );
    }
    else if ( e instanceof ConstraintViolationException ) {
      //FIXME this is bad cause ConstraintViolationException happens in other circumstances
      throwPersistenceException( new EntityExistsException( e ) );
    }
    else if ( e instanceof org.hibernate.QueryTimeoutException ) {
      javax.persistence.QueryTimeoutException converted = new javax.persistence.QueryTimeoutException(
          e.getMessage(), e
      );
View Full Code Here

    try {
      assertNotContains(theObj);
    }
    catch (Throwable e) {
      throw new EntityExistsException(e);
    }

    try {
      prePersist(theObj);
View Full Code Here

      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof org.hibernate.NonUniqueObjectException ) {
      EntityExistsException converted = new EntityExistsException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
      NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
View Full Code Here

      PersistenceException pe = wrapStaleStateException( (StaleStateException) e );
      throwPersistenceException( pe );
    }
    else if ( e instanceof ConstraintViolationException ) {
      //FIXME this is bad cause ConstraintViolationException happens in other circumstances
      throwPersistenceException( new EntityExistsException( e ) );
    }
    else if ( e instanceof ObjectNotFoundException ) {
      throwPersistenceException( new EntityNotFoundException( e.getMessage() ) );
    }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
View Full Code Here

      PersistenceException converted = wrapLockException( (HibernateException) e, null );
      throwPersistenceException( converted );
    }
    else if ( e instanceof ConstraintViolationException ) {
      //FIXME this is bad cause ConstraintViolationException happens in other circumstances
      throwPersistenceException( new EntityExistsException( e ) );
    }
    else if ( e instanceof org.hibernate.QueryTimeoutException ) {
      javax.persistence.QueryTimeoutException converted = new javax.persistence.QueryTimeoutException(
          e.getMessage(), e
      );
View Full Code Here

      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
        else if ( e instanceof org.hibernate.NonUniqueObjectException ) {
            EntityExistsException converted = new EntityExistsException( e.getMessage() );
            handlePersistenceException( converted );
            return converted;
        }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
      NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
View Full Code Here

            txn.commit();
            ub.clear();
            return result;
        } catch (final SQLException e) {
            if (e.getSQLState().equals("23000") && e.getErrorCode() == 1062) {
                throw new EntityExistsException("Entity already exists ", e);
            }
            throw new CloudRuntimeException("DB Exception on: " + pstmt, e);
        }
    }
View Full Code Here

                insertElementCollection(entity, _idAttributes.get(_table)[0], id, ecAttributes);
            }
            txn.commit();
        } catch (final SQLException e) {
            if (e.getSQLState().equals("23000") && e.getErrorCode() == 1062) {
                throw new EntityExistsException("Entity already exists: ", e);
            } else {
                throw new CloudRuntimeException("DB Exception on: " + pstmt, e);
            }
        } catch (IllegalArgumentException e) {
            throw new CloudRuntimeException("Problem with getting the ec attribute ", e);
View Full Code Here

TOP

Related Classes of javax.persistence.EntityExistsException

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.