Package org.datanucleus.exceptions

Examples of org.datanucleus.exceptions.NucleusOptimisticException


                        // No object deleted so either object disappeared or failed optimistic version checks
                        String msg = LOCALISER.msg("052203",
                            sm.toPrintableID(), sm.getInternalObjectId(),
                            "" + sm.getTransactionalVersion());
                        NucleusLogger.DATASTORE.error(msg);
                        throw new NucleusOptimisticException(msg, sm.getObject());
                    }

                    if (relatedObjectsToDelete != null && !relatedObjectsToDelete.isEmpty())
                    {
                        // Delete any related objects that need deleting after the delete of this object
View Full Code Here


            }

            if (optimisticFailures != null)
            {
                // Throw a single NucleusOptimisticException containing all optimistic failures
                throw new NucleusOptimisticException(LOCALISER.msg("010031"),
                    (Throwable[])optimisticFailures.toArray(new Throwable[optimisticFailures.size()]));
            }
        }
        finally
        {
View Full Code Here

                            // TODO Batching : when we use batching here we need to process these somehow
                            String msg = LOCALISER.msg("052203",
                                sm.toPrintableID(), sm.getInternalObjectId(),
                                "" + currentVersion);
                            NucleusLogger.PERSISTENCE.error(msg);
                            throw new NucleusOptimisticException(msg, sm.getObject());
                        }
                    }
                    finally
                    {
                        sqlControl.closeStatement(mconn, ps);
View Full Code Here

            ec.getStatistics().incrementNumReads();
          }
          refreshedEntity = datastoreMgr.getDatastoreServiceForReads(op.getExecutionContext()).get(entity.getKey());
        } catch (EntityNotFoundException e) {
          // someone deleted out from under us
          throw new NucleusOptimisticException(GAE_LOCALISER.msg("AppEngine.OptimisticError.EntityHasBeenDeleted", operation,
              cmd.getFullClassName(), entity.getKey()));
        }

        Object datastoreVersion = refreshedEntity.getProperty(versionPropertyName);
        if (vmd.getVersionStrategy() == VersionStrategy.DATE_TIME) {
          datastoreVersion = new Timestamp((Long) datastoreVersion);
        }

        if (!datastoreVersion.equals(curVersion)) {
          throw new NucleusOptimisticException(GAE_LOCALISER.msg("AppEngine.OptimisticError.EntityHasBeenUpdated", operation,
              cmd.getFullClassName(), entity.getKey()));
        }
      }

      Object nextVersion = VersionHelper.getNextVersion(vmd.getVersionStrategy(), curVersion);
View Full Code Here

    return ((MappedStoreManager)sm.getObjectManager().getStoreManager()).getIdentifierFactory();
  }

  private NucleusOptimisticException newNucleusOptimisticException(
      AbstractClassMetaData cmd, Entity entity, String op, String details) {
    return new NucleusOptimisticException(
        "Optimistic concurrency exception " + op + " " + cmd.getFullClassName()
            + " with pk " + entity.getKey() + ".  " + details);
  }
View Full Code Here

    return ((MappedStoreManager)sm.getObjectManager().getStoreManager()).getIdentifierFactory();
  }

  private NucleusOptimisticException newNucleusOptimisticException(
      AbstractClassMetaData cmd, Entity entity, String op, String details) {
    return new NucleusOptimisticException(
        "Optimistic concurrency exception " + op + " " + cmd.getFullClassName()
            + " with pk " + entity.getKey() + ".  " + details);
  }
View Full Code Here

            DBObject dbObject = MongoDBUtils.getObjectForObjectProvider(collection, op, true);
            if (dbObject == null)
            {
                if (cmd.hasVersionStrategy())
                {
                    throw new NucleusOptimisticException("Object with id " + op.getObjectId() +
                        " and version " + op.getTransactionalVersion() + " no longer present");
                }
                else
                {
                    throw new NucleusDataStoreException("Could not find object with id " + op.getObjectId());
View Full Code Here

            DBObject dbObject = MongoDBUtils.getObjectForObjectProvider(collection, op, true);
            if (dbObject == null)
            {
                if (cmd.hasVersionStrategy())
                {
                    throw new NucleusOptimisticException("Object with id " + op.getObjectId() +
                        " and version " + op.getTransactionalVersion() + " no longer present");
                }
                else
                {
                    throw new NucleusDataStoreException("Could not find object with id " + op.getObjectId());
View Full Code Here

                if (deleteObjectList != null) {
                    ((ForcePersistenceHandler) getStoreManager().getPersistenceHandler())
                        .deleteObjects(deleteObjectList.toArray(new String[deleteObjectList.size()]), getExecutionContext());
                }
            } catch (NucleusOptimisticException noe) {
                throw new NucleusOptimisticException(LOCALISER.msg("010031"), noe.getFailedObject());
            } finally {
                inAllOrNothingMode = false;
                createObjectList = null;
                updateObjectList = null;
                versionList = null;
View Full Code Here

        if (!valid)
        {
            String msg = LOCALISER.msg("032016",
                StringUtils.toJVMIDString(sm.getObject()), sm.getInternalObjectId(), "" + versionDatastore, "" + versionObject);
            NucleusLogger.PERSISTENCE.error(msg);
            throw new NucleusOptimisticException(msg, sm.getObject());
        }
    }
View Full Code Here

TOP

Related Classes of org.datanucleus.exceptions.NucleusOptimisticException

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.