当前位置: 首页>>代码示例>>Java>>正文


Java TableConfiguration.getGeneratedKey方法代码示例

本文整理汇总了Java中org.mybatis.generator.config.TableConfiguration.getGeneratedKey方法的典型用法代码示例。如果您正苦于以下问题:Java TableConfiguration.getGeneratedKey方法的具体用法?Java TableConfiguration.getGeneratedKey怎么用?Java TableConfiguration.getGeneratedKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mybatis.generator.config.TableConfiguration的用法示例。


在下文中一共展示了TableConfiguration.getGeneratedKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateIdentityColumns

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
/**
 * Calculate identity columns.
 *
 * @param tc
 *            the tc
 * @param columns
 *            the columns
 */
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);
                }
            }
        }
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:32,代码来源:DatabaseIntrospector.java

示例2: calculateIdentityColumns

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
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);
                }
            }
        }
    }
}
 
开发者ID:funny5258,项目名称:autocode,代码行数:22,代码来源:DatabaseIntrospector.java

示例3: calculateIdentityColumns

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
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);
                }
            }
        }
    }
}
 
开发者ID:handosme,项目名称:mybatis-generator-plus,代码行数:24,代码来源:DatabaseIntrospector.java

示例4: calculateIdentityColumns

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
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);
				}
			}
		}
	}
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:22,代码来源:DatabaseIntrospector.java

示例5: reportIntrospectionWarnings

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
/**
 * Report introspection warnings.
 *
 * @param introspectedTable
 *            the introspected table
 * @param tableConfiguration
 *            the table configuration
 * @param table
 *            the table
 */
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()));
        }
    }
    
    for (IntrospectedColumn ic : introspectedTable.getAllColumns()) {
        if (JavaReservedWords.containsWord(ic.getJavaProperty())) {
            warnings.add(getString("Warning.26", //$NON-NLS-1$
                    ic.getActualColumnName(), table.toString()));
        }
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:50,代码来源:DatabaseIntrospector.java

示例6: modelFieldGenerated

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
@Override
public boolean modelFieldGenerated(Field field, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn,
		IntrospectedTable introspectedTable, ModelClassType modelClassType) {
	String columnName = introspectedColumn.getActualColumnName();
	String columnNameStr = new StringBuilder("\"").append(columnName).append("\"").toString();
	
	TableConfiguration tabConfig  = introspectedTable.getTableConfiguration();
	
	//primaryKey
	List<IntrospectedColumn> primaryKeys =  introspectedTable.getPrimaryKeyColumns();
	for (IntrospectedColumn primaryColumn : primaryKeys) {
		if(primaryColumn.equals(introspectedColumn)){
			field.addAnnotation("@Id");
			field.addAnnotation("@GeneratedValue(generator="+columnNameStr+")");
			GeneratedKey genKey = tabConfig.getGeneratedKey();
			
			if(introspectedColumn.isIdentity()){
				
			}else if(introspectedColumn.isSequenceColumn()){
				field.addAnnotation("@SequenceGenerator(name="+columnNameStr+",sequenceName=\"" + genKey.getRuntimeSqlStatement() + "\")");
			}
			
			break;
		}
	}
	
	//Column mapping
	field.addAnnotation("@Column(name="+columnNameStr+")");
	
	return true;
}
 
开发者ID:thinking-github,项目名称:nbone,代码行数:32,代码来源:JpaAnnotationPlugin.java

示例7: reportIntrospectionWarnings

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
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()));
        }
    }
}
 
开发者ID:handosme,项目名称:mybatis-generator-plus,代码行数:33,代码来源:DatabaseIntrospector.java

示例8: reportIntrospectionWarnings

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
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()));
		}
	}
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:30,代码来源:DatabaseIntrospector.java


注:本文中的org.mybatis.generator.config.TableConfiguration.getGeneratedKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。