Package com.jfinal.plugin.activerecord

Examples of com.jfinal.plugin.activerecord.ActiveRecordException


      String paraKey = e.getKey();
      if (paraKey.startsWith(modelNameAndDot)) {
        String paraName = paraKey.substring(modelNameAndDot.length());
        Class colType = tableInfo.getColType(paraName);
        if (colType == null)
          throw new ActiveRecordException("The model attribute " + paraKey + " is not exists.");
        String[] paraValue = e.getValue();
        try {
          // Object value = Converter.convert(colType, paraValue != null ? paraValue[0] : null);
          Object value = paraValue[0] != null ? TypeConverter.convert(colType, paraValue[0]) : null;
          model.set(paraName, value);
View Full Code Here


        if (conn.getTransactionIsolation() < getTransactionLevel())
          conn.setTransactionIsolation(getTransactionLevel());
        invocation.invoke();
        return ;
      } catch (SQLException e) {
        throw new ActiveRecordException(e);
      }
    }
   
    Boolean autoCommit = null;
    try {
      conn = DbKit.getConnection();
      autoCommit = conn.getAutoCommit();
      DbKit.setThreadLocalConnection(conn);
      conn.setTransactionIsolation(getTransactionLevel())// conn.setTransactionIsolation(transactionLevel);
      conn.setAutoCommit(false);
      invocation.invoke();
      conn.commit();
    } catch (Exception e) {
      if (conn != null)
        try {conn.rollback();} catch (Exception e1) {e1.printStackTrace();}
      throw new ActiveRecordException(e);
    }
    finally {
      try {
        if (conn != null) {
          if (autoCommit != null)
View Full Code Here

 
  /**
   * SELECT * FROM subject t1 WHERE (SELECT count(*) FROM subject t2 WHERE t2.id < t1.id AND t2.key = '123') > = 10 AND (SELECT count(*) FROM subject t2 WHERE t2.id < t1.id AND t2.key = '123') < 20 AND t1.key = '123'
   */
  public void forPaginate(StringBuilder sql, int pageNumber, int pageSize, String select, String sqlExceptSelect) {
    throw new ActiveRecordException("Your should not invoke this method because takeOverDbPaginate(...) will take over it.");
  }
View Full Code Here

      List list = buildModel(rs, modelClass, pageSize);
      if (rs != null) rs.close();
      if (pst != null) pst.close();
      return new Page(list, pageNumber, pageSize, totalPage, (int)totalRow);
    } catch (Exception e) {
      throw new ActiveRecordException(e);
    } finally {
      DbKit.close(conn);
    }
  }
View Full Code Here

        for (XAResult xaResult : xaResults) {
          connection = ((Connection) xaResult.getXaConnection());
          try {
            xaResult.getXaResource().commit(xid, false);
          } catch (XAException xae) {
            throw new ActiveRecordException(xae);
          } finally {
            try {
              if (connection != null) {
                if (xaResult.getAutoCommit() != null) {
                  connection.setAutoCommit(xaResult.getAutoCommit());
View Full Code Here

        if (conn.getTransactionIsolation() < getTransactionLevel(config))
          conn.setTransactionIsolation(getTransactionLevel(config));
        //返回resource
        return new XAResult(config, prepareInvoke(xaConn, xid, ai), xaConn, null, false);
      } catch (SQLException e) {
        throw new ActiveRecordException(e);
      } catch (XAException xae) {
        throw new ActiveRecordException(xae);
      }
    }

    Boolean autoCommit = null;
    try {
      conn = config.getConnection();
      autoCommit = conn.getAutoCommit();
      config.setThreadLocalConnection(conn);
      conn.setTransactionIsolation(getTransactionLevel(config));    // conn.setTransactionIsolation(transactionLevel);
      conn.setAutoCommit(false);
      xaConn = (XAConnection) conn;
      return new XAResult(config, prepareInvoke(xaConn, xid, ai), xaConn, autoCommit, true);
    } catch (Exception e) {
      throw new ActiveRecordException(e);
    }
  }
View Full Code Here

      String paraKey = e.getKey();
      if (paraKey.startsWith(modelNameAndDot)) {
        String paraName = paraKey.substring(modelNameAndDot.length());
        Class colType = table.getColumnType(paraName);
        if (colType == null)
          throw new ActiveRecordException("The model attribute " + paraKey + " is not exists.");
        String[] paraValue = e.getValue();
        try {
          // Object value = Converter.convert(colType, paraValue != null ? paraValue[0] : null);
          Object value = paraValue[0] != null ? TypeConverter.convert(colType, paraValue[0]) : null;
          model.set(paraName, value);
View Full Code Here

 
  /**
   * SELECT * FROM subject t1 WHERE (SELECT count(*) FROM subject t2 WHERE t2.id < t1.id AND t2.key = '123') > = 10 AND (SELECT count(*) FROM subject t2 WHERE t2.id < t1.id AND t2.key = '123') < 20 AND t1.key = '123'
   */
  public void forPaginate(StringBuilder sql, int pageNumber, int pageSize, String select, String sqlExceptSelect) {
    throw new ActiveRecordException("Your should not invoke this method because takeOverDbPaginate(...) will take over it.");
  }
View Full Code Here

        if (conn.getTransactionIsolation() < getTransactionLevel(config))
          conn.setTransactionIsolation(getTransactionLevel(config));
        ai.invoke();
        return ;
      } catch (SQLException e) {
        throw new ActiveRecordException(e);
      }
    }
   
    Boolean autoCommit = null;
    try {
      conn = config.getConnection();
      autoCommit = conn.getAutoCommit();
      config.setThreadLocalConnection(conn);
      conn.setTransactionIsolation(getTransactionLevel(config))// conn.setTransactionIsolation(transactionLevel);
      conn.setAutoCommit(false);
      ai.invoke();
      conn.commit();
    } catch (NestedTransactionHelpException e) {
      if (conn != null) try {conn.rollback();} catch (Exception e1) {e1.printStackTrace();}
    } catch (Throwable t) {
      if (conn != null) try {conn.rollback();} catch (Exception e1) {e1.printStackTrace();}
      throw new ActiveRecordException(t);
    }
    finally {
      try {
        if (conn != null) {
          if (autoCommit != null)
View Full Code Here

            callbackListener.beforeSave(this);
        }
        Table tableInfo = TableMapping.me().getTable(clazz);
        if (pseudoDelete()) {
            if (!tableInfo.hasColumnLabel(deleteColumnLabel)) {
                throw new ActiveRecordException("The deleteColumnLabel (" + deleteColumnLabel + ") is not exist");
            }
            this.set(deleteColumnLabel, 0);
        }
        boolean result = super.save();
        for (CallbackListener callbackListener : callbackListeners) {
View Full Code Here

TOP

Related Classes of com.jfinal.plugin.activerecord.ActiveRecordException

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.