当前位置: 首页>>代码示例>>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;未经允许,请勿转载。