Package com.draagon.meta.manager.exp

Examples of com.draagon.meta.manager.exp.Expression


       
        // If no dirty writes, see if that was the issue
        if ( !allowsDirtyWrites ) {
         
          // Create the Expression for the Primary Keys
          Expression exp = null;
          for( MetaField mf : getPrimaryKeys( mc )) {
            Expression e = new Expression( mf.getName(), mf.getObject( obj ));
            if ( exp == null ) exp = e;
            else exp = exp.and( e );
          }
         
          if ( exp == null ) throw new PersistenceException( "MetaClass [" + mc + "] has no primary keys defined to delete object [" + obj + "]" );
         
          Collection<Object> results = getDatabaseDriver().readMany( conn, mc, mapping, new QueryOptions( exp ));
          if ( results.size() > 0 ) {
            throw new DirtyWriteException( obj );
          }
        }
       
        throw new ObjectNotFoundException( obj );
      }

      postPersistence( c, mc, obj, DELETE );
    }
    catch( SQLException e )
    {
      //log.error( "Unable to delete object of class [" + mc + "]: " + e.getMessage() );
      throw new PersistenceException( "Unable to delete object [" + obj + "] of class [" + mc + "]: " + e.getMessage(), e );
    }
  }
View Full Code Here

TOP

Related Classes of com.draagon.meta.manager.exp.Expression

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.