Package org.hibernate

Examples of org.hibernate.StaleStateException


   {
      ClassMetadata classMetadata = getClassMetadata(value, session);
      VersionType versionType = (VersionType) classMetadata.getPropertyTypes()[ classMetadata.getVersionProperty() ];
      if ( !versionType.isEqual(oldVersion, version) )
      {
         throw new StaleStateException("current database version number does not match passivated version number");
      }
   }
View Full Code Here


   {
      ClassMetadata classMetadata = getClassMetadata(value, session);
      VersionType versionType = (VersionType) classMetadata.getPropertyTypes()[ classMetadata.getVersionProperty() ];
      if ( !versionType.isEqual(oldVersion, version) )
      {
         throw new StaleStateException("current database version number does not match passivated version number");
      }
   }
View Full Code Here

      assertEquals(TestBean.class.getName(), ex.getPersistentClassName());
      assertEquals("id", ex.getIdentifier());
      assertEquals(sosex, ex.getCause());
    }

    final StaleStateException ssex = new StaleStateException("msg");
    try {
      hibernateTemplate.execute(new HibernateCallback<Object>() {
        @Override
        public Object doInHibernate(Session session)  {
          throw ssex;
View Full Code Here

      assertEquals(TestBean.class.getName(), ex.getPersistentClassName());
      assertEquals("id", ex.getIdentifier());
      assertEquals(sosex, ex.getCause());
    }

    final StaleStateException ssex = new StaleStateException("msg");
    try {
      hibernateTemplate.execute(new HibernateCallback<Object>() {
        @Override
        public Object doInHibernate(org.hibernate.Session session) throws HibernateException {
          throw ssex;
View Full Code Here

   * 保存用户时,演示Hibernate的version字段使用.
   */
  @Override
  public String save() throws Exception {
    if (workingVersion < entity.getVersion()) {
      throw new StaleStateException("对象已有新的版本");
    }

    accountManager.saveUser(entity);
    return RELOAD;
  }
View Full Code Here

   {
      ClassMetadata classMetadata = getClassMetadata(value, session);
      VersionType versionType = (VersionType) classMetadata.getPropertyTypes()[ classMetadata.getVersionProperty() ];
      if ( !versionType.isEqual(oldVersion, version) )
      {
         throw new StaleStateException("current database version number does not match passivated version number");
      }
   }
View Full Code Here

    private void checkBatched(int rowCount, int batchPosition) {
            if (rowCount == -2) LOG.debugf("Success of batch update unknown: %s", batchPosition);
            else if (rowCount == -3) throw new BatchFailedException("Batch update failed: " + batchPosition);
      else {
                if (expectedRowCount > rowCount) throw new StaleStateException(
                                                                               "Batch update returned unexpected row count from update ["
                                                                               + batchPosition + "]; actual row count: " + rowCount
                                                                               + "; expected: " + expectedRowCount);
        if ( expectedRowCount < rowCount ) {
          String msg = "Batch update returned unexpected row count from update [" +
View Full Code Here

      }
    }

    private void checkNonBatched(int rowCount) {
      if ( expectedRowCount > rowCount ) {
        throw new StaleStateException(
            "Unexpected row count: " + rowCount + "; expected: " + expectedRowCount
        );
      }
      if ( expectedRowCount < rowCount ) {
        String msg = "Unexpected row count: " + rowCount + "; expected: " + expectedRowCount;
View Full Code Here

   {
      ClassMetadata classMetadata = getClassMetadata(value, session);
      VersionType versionType = (VersionType) classMetadata.getPropertyTypes()[ classMetadata.getVersionProperty() ];
      if ( !versionType.isEqual(oldVersion, version) )
      {
         throw new StaleStateException("current database version number does not match passivated version number");
      }
   }
View Full Code Here

TOP

Related Classes of org.hibernate.StaleStateException

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.