Package jodd.db.oom

Examples of jodd.db.oom.DbOomException


    this.dbOomManager = dbOomManager;
    elapsed = System.currentTimeMillis();
    try {
      scanPaths(classpath);
    } catch (Exception ex) {
      throw new DbOomException("Scan classpath error", ex);
    }
    elapsed = System.currentTimeMillis() - elapsed;
    if (log.isInfoEnabled()) {
      log.info("DbOomManager configured in " + elapsed + " ms. Total entities: " + dbOomManager.getTotalNames());
    }
View Full Code Here


    Class<?> beanClass;
    try {
      beanClass = loadClass(entryName);
    } catch (ClassNotFoundException cnfex) {
      throw new DbOomException("Entry class not found: " + entryName, cnfex);
    }
    DbTable dbTable = beanClass.getAnnotation(DbTable.class);
    if (dbTable == null) {
      return;
    }
View Full Code Here

    DbOomManager dboom = DbOomManager.getInstance();
    Class type = entity.getClass();
    DbEntityDescriptor ded = dboom.lookupType(type);

    if (ded == null) {
      throw new DbOomException("Not an entity: " + type);
    }
    if (isPersistent(ded, entity) == false) {
      DbQuery q;
      if (keysGeneratedByDatabase == true) {
        q = query(insert(entity));
View Full Code Here

    //this.resultColumns = new HashSet<String>();
    try {
      ResultSetMetaData rsMetaData = resultSet.getMetaData();
      if (rsMetaData == null) {
        throw new DbOomException("No ResultSet meta-data");
      }

      totalColumns = rsMetaData.getColumnCount();

      this.resultColumns = new HashSet<String>(totalColumns);
      columnNames = new String[totalColumns];
      columnDbSqlTypes = new int[totalColumns];
      tableNames = new String[totalColumns];

      for (int i = 0; i < totalColumns; i++) {
        String columnName = rsMetaData.getColumnLabel(i + 1);

        if (columnName == null) {
          columnName = rsMetaData.getColumnName(i + 1);
        }

        String tableName = null;

        // resolve column and table name
        int sepNdx = columnName.indexOf(dbOomManager.getColumnAliasSeparator());
        if (sepNdx != -1) {
          // column alias exist, result set is ignored and columnAliases contains table data
          tableName = columnName.substring(0, sepNdx);
          if (columnAliases != null) {
            ColumnData columnData = columnAliases.get(tableName);
            if (columnData != null) {
              tableName = columnData.getTableName();
            }
          }
          columnName = columnName.substring(sepNdx + 1);
        } else {
          // column alias does not exist, table name is read from columnAliases and result set (if available)
          if (columnAliases != null) {
            ColumnData columnData = columnAliases.get(columnName);
            if (columnData != null) {
              tableName = columnData.getTableName();
              columnName = columnData.getColumnName();
            }
          }
          if (tableName == null) {
            try {
              tableName = rsMetaData.getTableName(i + 1);
            } catch (SQLException sex) {
              // ignore
          }
            if ((tableName != null) && (tableName.length() == 0)) {
              tableName = null;
            }
          }
        }

        columnName = columnName.trim();
        if (columnName.length() == 0) {
          columnName = null;
        }

        if (columnName != null) {
          columnName = columnName.trim();
          columnName = columnName.toUpperCase();
        }
        columnNames[i] = columnName;

        if (tableName != null) {
          tableName = tableName.trim();
          tableName = tableName.toUpperCase();
        }
        tableNames[i] = tableName;
        columnDbSqlTypes[i] = rsMetaData.getColumnType(i + 1);
      }
    } catch (SQLException sex) {
      throw new DbOomException(dbOomQuery, "Reading ResultSet meta-data failed", sex);
    }
  }
View Full Code Here

      String tableName = tableNames[i];
      String columnName = columnNames[i];

      if (tableName == null) {
        // maybe JDBC driver does not support it
        throw new DbOomException(dbOomQuery, "Table name missing in meta-data");
      }

      if ((tableName.equals(lastTableName) == false) || (resultColumns.contains(columnName) == true)) {
        resultColumns.clear();
        lastTableName = tableName;

        DbEntityDescriptor ded = dbOomManager.lookupTableName(tableName);
        if (ded == null) {
          throw new DbOomException(dbOomQuery, "Table name not registered: " + tableName);
        }

        classes.add(ded.getType());
      }
      resultColumns.add(columnName);
View Full Code Here

        } else {
          cachedColumnValue = resultSet.getObject(colNdx + 1);
          cachedColumnValue = TypeConverterManager.convertType(cachedColumnValue, destinationType);
        }
      } catch (SQLException sex) {
        throw new DbOomException(dbOomQuery, "Invalid value for column #" + (colNdx + 1), sex);
      }
      cachedColumnNdx = colNdx;
    }
    return cachedColumnValue;
  }
View Full Code Here

    if (query == null) {
      query = resolveQuery(proxyTargetInfo);

      if (query == null) {
        throw new DbOomException("Query not resolved.");
      }
    }

    // sql generator
View Full Code Here

      method = proxyTargetInfo.targetClass.getDeclaredMethod(
        proxyTargetInfo.targetMethodName,
        proxyTargetInfo.argumentsClasses
      );
    } catch (NoSuchMethodException ex) {
      throw new DbOomException(ex);
    }

    MethodParameter[] methodParameters = Paramo.resolveParameters(method);

    paramNames = new String[methodParameters.length];
View Full Code Here

   */
  public boolean next() {
    try {
      return resultSet.next();
    } catch (SQLException sex) {
      throw new DbOomException(sex);
    }
  }
View Full Code Here

    elapsed = System.currentTimeMillis();
    try {
      scanPaths(classpath);
    } catch (Exception ex) {
      throw new DbOomException("Scan classpath error", ex);
    }
    elapsed = System.currentTimeMillis() - elapsed;
    if (log.isInfoEnabled()) {
      log.info("DbOomManager configured in " + elapsed + " ms. Total entities: " + dbOomManager.getTotalNames());
    }
View Full Code Here

TOP

Related Classes of jodd.db.oom.DbOomException

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.