org.apache.metamodel.schema.Table.getPrimaryKeys()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(259)

本文整理了Java中org.apache.metamodel.schema.Table.getPrimaryKeys()方法的一些代码示例,展示了Table.getPrimaryKeys()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getPrimaryKeys()方法的具体详情如下:
包路径:org.apache.metamodel.schema.Table
类名称:Table
方法名:getPrimaryKeys

Table.getPrimaryKeys介绍

[英]Gets the columns of this table that are known to be primary keys. See Column#isPrimaryKey().
[中]

代码示例

代码示例来源:origin: apache/metamodel

  1. public Schema toSerializableForm() {
  2. for (Table table : getTables()) {
  3. table.getColumns();
  4. table.getIndexedColumns();
  5. table.getPrimaryKeys();
  6. }
  7. loadRelations();
  8. return this;
  9. }

代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc

  1. public Schema toSerializableForm() {
  2. for (Table table : getTables()) {
  3. table.getColumns();
  4. table.getIndexedColumns();
  5. table.getPrimaryKeys();
  6. }
  7. loadRelations();
  8. return this;
  9. }

代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core

  1. Column[] primaryKeyColumns = _table.getPrimaryKeys();
  2. if (primaryKeyColumns == null || primaryKeyColumns.length == 0) {
  3. logger.info("No primary keys defined for table {}, not pre-selecting primary keys", _table.getName());

代码示例来源:origin: datacleaner/DataCleaner

  1. /**
  2. * Inspects the row processed tables primary keys. If all primary keys are
  3. * in the source columns of the AnalysisJob, they will be added to the
  4. * physically queried columns.
  5. *
  6. * Adding the primary keys to the query is a trade-off: It helps a lot in
  7. * making eg. annotated rows referenceable to the source table, but it may
  8. * also potentially make the job heavier to execute since a lot of (unique)
  9. * values will be retrieved.
  10. */
  11. public void addPrimaryKeysIfSourced() {
  12. final List<Column> primaryKeyColumns = getTable().getPrimaryKeys();
  13. if (primaryKeyColumns == null || primaryKeyColumns.isEmpty()) {
  14. logger.info("No primary keys defined for table {}, not pre-selecting primary keys", getTable().getName());
  15. return;
  16. }
  17. final Collection<InputColumn<?>> sourceInputColumns = getAnalysisJob().getSourceColumns();
  18. final List<Column> sourceColumns = CollectionUtils.map(sourceInputColumns, InputColumn::getPhysicalColumn);
  19. for (final Column primaryKeyColumn : primaryKeyColumns) {
  20. if (!sourceColumns.contains(primaryKeyColumn)) {
  21. logger.info("Primary key column {} not added to source columns, not pre-selecting primary keys");
  22. return;
  23. }
  24. }
  25. addPhysicalColumns(primaryKeyColumns);
  26. }

代码示例来源:origin: datacleaner/DataCleaner

  1. final List<Column> primaryKeys = sourceTable.getPrimaryKeys();
  2. if (primaryKeys.size() == 1) {
  3. final Column primaryKey = primaryKeys.get(0);

代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-cluster

  1. final Column[] primaryKeys = sourceTable.getPrimaryKeys();
  2. if (primaryKeys.length == 1) {
  3. final Column primaryKey = primaryKeys[0];

相关文章