Examples of PersistenceException


Examples of de.iritgo.aktera.persist.PersistenceException

    {
      oneReserved = (String) allReserved.next();

      if (oneReserved.equalsIgnoreCase(word))
      {
        throw new PersistenceException(
                "You cannot have a field or table name of '"
                        + word
                        + "'.  It is a reserved word for this database type.  Check database documentation for a full list.");
      }
    }
View Full Code Here

Examples of fr.soleil.salsa.exception.persistence.PersistenceException

        Document d;
        try {
            d = ConfigAsXmlHelper.toXml(config);
        }
        catch (ConversionException e) {
            throw new PersistenceException(e.getMessage(), e);
        }

        Configuration c = new Configuration();
        c.setId(config.getId());
        c.setName(config.getName());
View Full Code Here

Examples of gate.persist.PersistenceException

  public LanguageResource adopt(LanguageResource langres) throws PersistenceException {
    LanguageResource lr = langres;
    if(lr instanceof Document) {
      Document doc = (Document)lr;
      if(doc.getDataStore() == null || doc.getDataStore() != this) {
        throw new PersistenceException("Cannot adopt document, already in a different datastore: "+lr.getName());
      }
      // otherwise, the document is already adopted by this datastore so we
      // silently ignore this.
    } else if(lr instanceof CorpusImpl) {
      // only a transient, empty corpus can be adopted!!!
      Corpus corpus = (Corpus)lr;
      if(corpus.getDataStore() != null) {
        throw new PersistenceException(
          "Cannot adopt corpus "+corpus.getName()+
          " which belongs to datastore "+corpus.getDataStore().getName());
      }
      if(corpus.size() != 0) {
        throw new PersistenceException(
          "Cannot adopt corpus "+corpus.getName()+
          " which is non empty, number of documents contained: "+
          corpus.size());
      }
      // since this is a valid corpus, we adopt it by returning new
      // DocumentSubsetCorpus which has the original corpus as a parent
      FeatureMap parms = Factory.newFeatureMap();
      parms.put("jdbcCorpus", ourCorpus);
      try {
        Resource newCorpus = Factory.createResource(
          "at.ofai.gate.virtualcorpus.JDBCSubsetCorpus", parms,
          corpus.getFeatures(), corpus.getName());
        lr = (LanguageResource)newCorpus;
      } catch (ResourceInstantiationException ex) {
        throw new PersistenceException(
          "Could not adopt corpus "+corpus.getName(),ex);
      }
    } else {
      throw new PersistenceException("Cannot adopt LR: "+lr.getName());
    }
    return lr;
  }
View Full Code Here

Examples of javax.persistence.PersistenceException

                StringUtils.toJVMIDString(entity), "" + om.getApiAdapter().getIdForObject(entity)));
        }
        if (!contains(entity))
        {
            // The object is not contained (the javadoc doesnt explicitly say which exception to throw here)
            throw new PersistenceException("Entity is not contained in this persistence context so cant lock it");
        }

        // TODO Implement lock()
    }
View Full Code Here

Examples of javax.persistence.PersistenceException

        if (jdoe instanceof JDODataStoreException)
        {
            // JPA doesnt have "datastore" exceptions so just give a PersistenceException
            if (jdoe.getNestedExceptions() != null)
            {
                return new PersistenceException(jdoe.getMessage(), jdoe.getCause());
            }
            else
            {
                return new PersistenceException(jdoe.getMessage(), jdoe);
            }
        }
        else if (jdoe instanceof JDOObjectNotFoundException)
        {
            return new EntityNotFoundException(jdoe.getMessage());
        }
        else if (jdoe instanceof JDOUserException)
        {
            // JPA doesnt have "user" exceptions so just give a PersistenceException
            if (jdoe.getNestedExceptions() != null)
            {
                return new PersistenceException(jdoe.getMessage(), jdoe.getCause());
            }
            else
            {
                return new PersistenceException(jdoe.getMessage(), jdoe);
            }
        }
        else if (jdoe instanceof JDOOptimisticVerificationException)
        {
            if (jdoe.getNestedExceptions() != null)
            {
                return new OptimisticLockException(jdoe.getMessage(), jdoe.getCause());
            }
            else
            {
                return new OptimisticLockException(jdoe.getMessage(), jdoe);
            }
        }
        else
        {
            // JPA doesnt have "internal" exceptions so just give a PersistenceException
            if (jdoe.getNestedExceptions() != null)
            {
                return new PersistenceException(jdoe.getMessage(), jdoe.getCause());
            }
            else
            {
                return new PersistenceException(jdoe.getMessage(), jdoe);
            }
        }
    }
View Full Code Here

Examples of javax.persistence.PersistenceException

        else if (jpe instanceof JPOXDataStoreException)
        {
            // JPA doesnt have "datastore" exceptions so just give a PersistenceException
            if (jpe.getNestedExceptions() != null)
            {
                return new PersistenceException(jpe.getMessage(), jpe.getCause());
            }
            else
            {
                return new PersistenceException(jpe.getMessage(), jpe);
            }
        }
        else if (jpe instanceof JPOXObjectNotFoundException)
        {
            return new EntityNotFoundException(jpe.getMessage());
        }
        else if (jpe instanceof JPOXUserException)
        {
            // JPA doesnt have "user" exceptions so just give a PersistenceException
            if (jpe.getNestedExceptions() != null)
            {
                return new PersistenceException(jpe.getMessage(), jpe.getCause());
            }
            else
            {
                return new PersistenceException(jpe.getMessage(), jpe);
            }
        }
        else if (jpe instanceof JPOXOptimisticException)
        {
            if (jpe.getNestedExceptions() != null)
            {
                return new OptimisticLockException(jpe.getMessage(), jpe.getCause());
            }
            else
            {
                return new OptimisticLockException(jpe.getMessage(), jpe);
            }
        }
        else
        {
            // JPA doesnt have "internal" exceptions so just give a PersistenceException
            if (jpe.getNestedExceptions() != null)
            {
                return new PersistenceException(jpe.getMessage(), jpe.getCause());
            }
            else
            {
                return new PersistenceException(jpe.getMessage(), jpe);
            }
        }
    }
View Full Code Here

Examples of net.sf.jportlet.portlets.PersistenceException

            return bk.getId(  );
        }
        catch ( HibernateException e )
        {
            rollback( tx );
            throw new PersistenceException( e );
        }
        catch ( SQLException e )
        {
            rollback( tx );
            throw new PersistenceException( e );
        }
        finally
        {
            close( session );
        }
View Full Code Here

Examples of net.sf.jportlet.portlets.PersistenceException

            throw new ObjectNotFoundException( "Bookmark#" + id + " not found" );
        }
        catch ( HibernateException e )
        {
            rollback( tx );
            throw new PersistenceException( e );
        }
        catch ( SQLException e )
        {
            rollback( tx );
            throw new PersistenceException( e );
        }
        finally
        {
            close( session );
        }
View Full Code Here

Examples of net.sf.jportlet.portlets.PersistenceException

            tx.commit(  );
        }
        catch ( HibernateException e )
        {
            rollback( tx );
            throw new PersistenceException( e );
        }
        catch ( SQLException e )
        {
            rollback( tx );
            throw new PersistenceException( e );
        }
        finally
        {
            close( session );
        }
View Full Code Here

Examples of net.sf.jportlet.portlets.PersistenceException

        {
            throw new ObjectNotFoundException( "Bookmark#" + id + " not found" );
        }
        catch ( HibernateException e )
        {
            throw new PersistenceException( e );
        }
        catch ( SQLException e )
        {
            throw new PersistenceException( e );
        }
        finally
        {
            close( session );
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.