Java Code Examples for org.mybatis.generator.config.TableConfiguration#getGeneratedKey()
The following examples show how to use
org.mybatis.generator.config.TableConfiguration#getGeneratedKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseIntrospector.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
private void calculateIdentityColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) { GeneratedKey gk = tc.getGeneratedKey(); if (gk == null) { // no generated key, then no identity or sequence columns return; } for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns .entrySet()) { for (IntrospectedColumn introspectedColumn : entry.getValue()) { if (isMatchedColumn(introspectedColumn, gk)) { if (gk.isIdentity() || gk.isJdbcStandard()) { introspectedColumn.setIdentity(true); introspectedColumn.setSequenceColumn(false); } else { introspectedColumn.setIdentity(false); introspectedColumn.setSequenceColumn(true); } } } } }
Example 2
Source File: DatabaseIntrospector.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
private void calculateIdentityColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) { GeneratedKey gk = tc.getGeneratedKey(); if (gk == null) { // no generated key, then no identity or sequence columns return; } for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns .entrySet()) { for (IntrospectedColumn introspectedColumn : entry.getValue()) { if (isMatchedColumn(introspectedColumn, gk)) { if (gk.isIdentity() || gk.isJdbcStandard()) { introspectedColumn.setIdentity(true); introspectedColumn.setSequenceColumn(false); } else { introspectedColumn.setIdentity(false); introspectedColumn.setSequenceColumn(true); } } } } }
Example 3
Source File: DatabaseIntrospector.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
private void reportIntrospectionWarnings( IntrospectedTable introspectedTable, TableConfiguration tableConfiguration, FullyQualifiedTable table) { // make sure that every column listed in column overrides // actually exists in the table for (ColumnOverride columnOverride : tableConfiguration .getColumnOverrides()) { if (!introspectedTable.getColumn(columnOverride.getColumnName()).isPresent()) { warnings.add(getString("Warning.3", columnOverride.getColumnName(), table.toString())); } } // make sure that every column listed in ignored columns // actually exists in the table for (String string : tableConfiguration.getIgnoredColumnsInError()) { warnings.add(getString("Warning.4", string, table.toString())); } GeneratedKey generatedKey = tableConfiguration.getGeneratedKey(); if (generatedKey != null && !introspectedTable.getColumn(generatedKey.getColumn()).isPresent()) { if (generatedKey.isIdentity()) { warnings.add(getString("Warning.5", generatedKey.getColumn(), table.toString())); } else { warnings.add(getString("Warning.6", generatedKey.getColumn(), table.toString())); } } for (IntrospectedColumn ic : introspectedTable.getAllColumns()) { if (JavaReservedWords.containsWord(ic.getJavaProperty())) { warnings.add(getString("Warning.26", ic.getActualColumnName(), table.toString())); } } }
Example 4
Source File: DatabaseIntrospector.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
private void reportIntrospectionWarnings( IntrospectedTable introspectedTable, TableConfiguration tableConfiguration, FullyQualifiedTable table) { // make sure that every column listed in column overrides // actually exists in the table for (ColumnOverride columnOverride : tableConfiguration .getColumnOverrides()) { if (introspectedTable.getColumn(columnOverride.getColumnName()) == null) { warnings.add(getString("Warning.3", //$NON-NLS-1$ columnOverride.getColumnName(), table.toString())); } } // make sure that every column listed in ignored columns // actually exists in the table for (String string : tableConfiguration.getIgnoredColumnsInError()) { warnings.add(getString("Warning.4", //$NON-NLS-1$ string, table.toString())); } GeneratedKey generatedKey = tableConfiguration.getGeneratedKey(); if (generatedKey != null && introspectedTable.getColumn(generatedKey.getColumn()) == null) { if (generatedKey.isIdentity()) { warnings.add(getString("Warning.5", //$NON-NLS-1$ generatedKey.getColumn(), table.toString())); } else { warnings.add(getString("Warning.6", //$NON-NLS-1$ generatedKey.getColumn(), table.toString())); } } }