Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EODatabaseContext.lock()


            EOAdaptorChannel channel = null;
            int rows = 0;
            ec.lock();
            try {
                EODatabaseContext dbc = EOUtilities.databaseContextForModelNamed(ec, modelName);
                dbc.lock();
                try {
                    channel = dbc.availableChannel().adaptorChannel();
                    wasOpen = channel.isOpen();
                    if(!wasOpen) {
                        channel.openChannel();
View Full Code Here


    // ENHANCEME: Could also support the option of using a seperate EOF stack so
    // as to execute
    // sql in a non-blocking fashion.
    public static void evaluateSQLWithEntity(EOEditingContext ec, EOEntity entity, String exp) {
        EODatabaseContext dbContext = EODatabaseContext.registeredDatabaseContextForModel(entity.model(), ec);
        dbContext.lock();
        try {
          EOAdaptorChannel adaptorChannel = dbContext.availableChannel().adaptorChannel();
          if (!adaptorChannel.isOpen()) {
            adaptorChannel.openChannel();
          }
View Full Code Here

     */
    public static NSArray rawRowsForSQLExpression(EOEditingContext ec, EOModel model, EOSQLExpression expression, NSArray<EOAttribute> attributes) {
        NSArray results = NSArray.EmptyArray;
        EODatabaseContext dbc = EODatabaseContext.registeredDatabaseContextForModel(model, ec);
       
        dbc.lock();
        try {
            results = _rawRowsForSQLExpression(dbc, expression, attributes);
        }
        catch (Exception localException) {
            if (dbc._isDroppedConnectionException(localException)) {
View Full Code Here

    public static EOSQLExpression sqlExpressionForFetchSpecification(EOEditingContext ec, EOFetchSpecification spec, long start, long end) {
      EOSQLExpression expression = null;
        EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, spec.entityName());
        EOModel model = entity.model();
        EODatabaseContext dbc = EODatabaseContext.registeredDatabaseContextForModel(model, ec);
        dbc.lock();
        try {
          ERXSQLHelper sqlHelper = ERXSQLHelper.newSQLHelper(ec, model.name());
          expression = sqlHelper.sqlExpressionForFetchSpecification(ec, spec, start, end);
        }
        catch (Exception e) {
View Full Code Here

      EOModel model = entity.model();

      EODatabaseContext dbc = EODatabaseContext.registeredDatabaseContextForModel(model, ec);
      int results = 0;

      dbc.lock();
      try {
        results = ERXSQLHelper.newSQLHelper(ec, model.name()).rowCountForFetchSpecification(ec, spec);
      }
      catch (Exception localException) {
        if (dbc._isDroppedConnectionException(localException)) {
View Full Code Here

     */
    public static NSDictionary primaryKeyDictionaryForEntity(EOEditingContext ec, String entityName) {
      EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName);
      EODatabaseContext dbContext = EODatabaseContext.registeredDatabaseContextForModel(entity.model(), ec);
      NSDictionary primaryKey = null;
      dbContext.lock();
      try {
        EOAdaptorChannel adaptorChannel = dbContext.availableChannel().adaptorChannel();
        if (!adaptorChannel.isOpen()) {
          adaptorChannel.openChannel();
        }
View Full Code Here

       }
       catch (IllegalStateException e) {
         log.warn("Model " + model.name() + " failed: " + e.getMessage());
       }
       if (databaseContext != null) {
         databaseContext.lock();
         try {
           EODatabase database = databaseContext.database();
           if (!verifiedDatabases.containsObject(database)) {
             Enumeration gidEnum = database.snapshots().keyEnumerator();
             while (gidEnum.hasMoreElements()) {
View Full Code Here

            if (log.isDebugEnabled()) {
              log.debug("Batch fetching '" + path + "' relationship on " + sourceObjects);
            }

            EODatabaseContext dbContext = ERXEOAccessUtilities.databaseContextForObject(eo);
            dbContext.lock();
            try {
              ERXEOAccessUtilities.batchFetchRelationship(dbContext, relationship, sourceObjects, ec, skipFaultedSourceObjects);
            }
            finally {
              dbContext.unlock();
View Full Code Here

                result.addObject(eo);
              }
              else {
                NSDictionary row;
                    EODatabaseContext databaseContext = (EODatabaseContext) ((EOObjectStoreCoordinator) ec.rootObjectStore()).objectStoreForGlobalID(g);
                    databaseContext.lock();
                    try {
                  row = databaseContext.snapshotForGlobalID(g, ec.fetchTimestamp());
                    }
                    finally {
                      databaseContext.unlock();
View Full Code Here

            EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName);
            for (Enumeration keyPaths = prefetchingKeypaths.objectEnumerator(); keyPaths.hasMoreElements();) {
              String keypath = (String) keyPaths.nextElement();
              EORelationship relationship = entity.relationshipNamed(keypath);
              EODatabaseContext dbc = ERXEOAccessUtilities.databaseContextForEntityNamed((EOObjectStoreCoordinator) ec.rootObjectStore(), entityName);
              dbc.lock();
              try {
                dbc.batchFetchRelationship(relationship, objects, ec);
              } finally {
                dbc.unlock();
              }
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.