當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectNotFoundException類代碼示例

本文整理匯總了Java中org.databene.commons.ObjectNotFoundException的典型用法代碼示例。如果您正苦於以下問題:Java ObjectNotFoundException類的具體用法?Java ObjectNotFoundException怎麽用?Java ObjectNotFoundException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ObjectNotFoundException類屬於org.databene.commons包,在下文中一共展示了ObjectNotFoundException類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: importSchemas

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public void importSchemas(Database database) throws SQLException {
     LOGGER.debug("Importing schemas from environment '{}'", database.getEnvironment());
     StopWatch watch = new StopWatch("importSchemas");
     int schemaCount = 0;
     ResultSet schemaSet = metaData.getSchemas();
     while (schemaSet.next()) {
         String schemaName = schemaSet.getString(1);
         String catalogName = null;
         int columnCount = schemaSet.getMetaData().getColumnCount();
if (columnCount >= 2)
         	catalogName = schemaSet.getString(2);
         if (schemaName.equalsIgnoreCase(this.schemaName) 
         		|| (this.schemaName == null && dialect.isDefaultSchema(schemaName, user))) {
          LOGGER.debug("importing schema {}", StringUtil.quoteIfNotNull(schemaName));
      	this.schemaName = schemaName; // take over capitalization used in the DB
          String catalogNameOfSchema = (columnCount >= 2 && catalogName != null ? catalogName : this.catalogName); // PostgreSQL and SQL Server do not necessarily tell you the catalog name
      	DBCatalog catalogOfSchema = database.getCatalog(catalogNameOfSchema);
      	if (catalogOfSchema == null)
      		throw new ObjectNotFoundException("Catalog not found: " + catalogOfSchema);
      	new DBSchema(schemaName, catalogOfSchema);
          schemaCount++;
         } else
             LOGGER.debug("ignoring schema {}", StringUtil.quoteIfNotNull(schemaName));
     }
     if (schemaCount == 0) {
     	// add a default schema if none was reported (e.g. by MySQL)
     	DBCatalog catalogToUse = database.getCatalog(catalogName);
     	if (catalogToUse == null)
     		catalogToUse = database.getCatalogs().get(0);
    		catalogToUse.addSchema(new DBSchema(null));
     }
     schemaSet.close();
     watch.stop();
 }
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:35,代碼來源:JDBCDBImporter.java

示例2: getTable

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public DBTable getTable(String name, boolean required) {
    for (DBSchema schema : getSchemas())
        for (DBTable table : schema.getTables())
        	if (table.getName().equals(name))
        		return table;
    if (required)
    	throw new ObjectNotFoundException("Table '" + name + "'");
    else
    	return null;
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:11,代碼來源:DBCatalog.java

示例3: parseFK

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
private static DBForeignKeyConstraint parseFK(String spec, Database database) {
	spec = spec.trim();
	int iBracket = spec.indexOf('(');
	String tableName = spec.substring(0, iBracket);
	String columnList = spec.substring(iBracket + 1, spec.length() - 1);
	String[] columns = StringUtil.splitAndTrim(columnList, ',');
	DBTable refererTable = database.getTable(tableName, true);
	DBForeignKeyConstraint fk = refererTable.getForeignKeyConstraint(columns);
	if (fk == null)
		throw new ObjectNotFoundException("Foreign ke constraint not found: " + tableName + 
				'(' + ArrayFormat.format(columns) + ')');
	return fk;
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:14,代碼來源:ForeignKeyPath.java

示例4: columnReferencedBy

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public String columnReferencedBy(String fkColumnName, boolean required) {
	int index = ArrayUtil.indexOf(fkColumnName, fkColumnNames);
	if (index < 0) {
		if (required)
			throw new ObjectNotFoundException("foreign key '" + name + "' does not have a column '" + fkColumnName + "'");
		else
			return null;
	}
	return refereeColumnNames[index];
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:11,代碼來源:DBForeignKeyConstraint.java

示例5: getSchema

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public DBSchema getSchema(String schemaName) {
       for (DBCatalog catalog : getCatalogs()) {
           DBSchema schema = catalog.getSchema(schemaName);
           if (schema != null)
           	return schema;
       }
       throw new ObjectNotFoundException("Table '" + name + "'");
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:9,代碼來源:Database.java

示例6: getTable

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public DBTable getTable(String name, boolean required) {
    for (DBCatalog catalog : getCatalogs())
        for (DBTable table : catalog.getTables())
        	if (StringUtil.equalsIgnoreCase(table.getName(), name))
        		return table;
    if (required)
    	throw new ObjectNotFoundException("Table '" + name + "'");
    else
    	return null;
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:11,代碼來源:Database.java

示例7: getColumn

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public DBColumn getColumn(String columnName) {
haveColumnsImported();
      DBColumn column = columns.get(columnName);
      if (column == null)
          throw new ObjectNotFoundException("Column '" + columnName + 
                  "' not found in table '" + this.getName() + "'");
      return column;
  }
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:9,代碼來源:DBTable.java

示例8: getForeignKeyConstraint

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public DBForeignKeyConstraint getForeignKeyConstraint(String... columnNames) {
   	haveFKsImported();
	for (DBForeignKeyConstraint fk : foreignKeyConstraints)
		if (StringUtil.equalsIgnoreCase(fk.getColumnNames(), columnNames))
			return fk;
	throw new ObjectNotFoundException("Table '" + name + "' has no foreign key " +
			"with the columns (" + ArrayFormat.format(columnNames) + ")");
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:9,代碼來源:DBTable.java

示例9: queryByPK

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public DBRow queryByPK(Object pk, Connection connection, DatabaseDialect dialect) throws SQLException {
  	String[] pkColumnNames = getPrimaryKeyConstraint().getColumnNames();
  	if (pkColumnNames.length == 0)
  		throw new ObjectNotFoundException("Table " + name + " has no primary key");
  	Object[] pkComponents = (pk.getClass().isArray() ? (Object[]) pk : new Object[] { pk });
String whereClause = SQLUtil.renderWhereClause(pkColumnNames, pkComponents, dialect);
      DBRowIterator iterator = new DBRowIterator(this, connection, whereClause);
      if (!iterator.hasNext())
      	throw new ObjectNotFoundException("No " + name + " row with id (" + pkComponents + ")");
DBRow result = iterator.next();
iterator.close();
return result;
  }
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:14,代碼來源:DBTable.java

示例10: getSequence

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public DBSequence getSequence(String sequenceName, Connection connection) throws SQLException {
	DBSequence[] sequences = querySequences(connection);
	for (DBSequence seq : sequences)
		if (seq.getName().equalsIgnoreCase(sequenceName))
			return seq;
	throw new ObjectNotFoundException("No sequence found with name '" + sequenceName + "'");
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:8,代碼來源:DatabaseDialect.java

示例11: getTable

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public DBTable getTable(String tableName) {
	parseMetadataIfNecessary();
    DBTable table = findTableInConfiguredCatalogAndSchema(tableName);
    if (table != null)
        return table;
    table = findAnyTableOfName(tableName);
    if (table != null) {
       	logger.warn("Table '" + tableName + "' not found " +
       			"in the expected catalog '" + catalogName + "' and schema '" + schemaName + "'. " +
				"I have taken it from catalog '" + table.getCatalog() + "' and schema '" + table.getSchema() + "' instead. " +
				"You better make sure this is right and fix the configuration");
        return table;
    }
    throw new ObjectNotFoundException("Table " + tableName);
}
 
開發者ID:raphaelfeng,項目名稱:benerator,代碼行數:16,代碼來源:DBSystem.java

示例12: assertNext

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public static void assertNext(ResultSet resultSet, String query)
		throws SQLException {
	if (!resultSet.next())
		throw new ObjectNotFoundException("Database query did not return a result: " + query);
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:6,代碼來源:DBUtil.java

示例13: getIdentity

import org.databene.commons.ObjectNotFoundException; //導入依賴的package包/類
public IdentityModel getIdentity(String tableName, boolean required) {
	IdentityModel result = identities.get(tableName);
	if (required && (result == null || result instanceof NoIdentity))
		throw new ObjectNotFoundException("No identity defined for table '" + tableName + "'");
	return result;
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:7,代碼來源:IdentityProvider.java


注:本文中的org.databene.commons.ObjectNotFoundException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。