org.mybatis.generator.config.TableConfiguration Java Examples

The following examples show how to use org.mybatis.generator.config.TableConfiguration. 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: CustomPlugin.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
/**
 * 增加数据源名称字段
 * 
 * @author 吴帅
 * @parameter @param interfaze
 * @parameter @param introspectedTable
 * @createDate 2015年10月2日 上午10:06:47
 */
private void addDataSourceNameField(Interface interfaze, IntrospectedTable introspectedTable) {
	TableConfiguration tableConfiguration = introspectedTable.getTableConfiguration();
	Properties properties = tableConfiguration.getProperties();
	String dataSourceName = properties.getProperty("dataSourceName");
	if (dataSourceName == null || dataSourceName == "") {
		return;
	}
	Field field = new Field();
	field.setVisibility(JavaVisibility.PUBLIC);
	field.setStatic(true);
	field.setFinal(true);
	field.setType(FullyQualifiedJavaType.getStringInstance());
	field.setName("DATA_SOURCE_NAME");
	field.setInitializationString("\"" + dataSourceName + "\"");
	interfaze.addField(field);
}
 
Example #2
Source File: UpdateByOptimisticLockMethodGenerator.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
@Override
public void addMethod(Interface interfaze, IntrospectedTable introspectedTable) {
    TableConfiguration tableConfiguration = introspectedTable.getTableConfiguration();
    Properties properties = tableConfiguration.getProperties();
    String versionField = properties.getProperty("versionField");
    if (versionField == null || versionField == "") {
        return;
    }
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<>();
    FullyQualifiedJavaType parameterType;
    if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
        parameterType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
    } else {
        parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
    }
    importedTypes.add(parameterType);
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setName(METHOD_NAME);
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
    interfaze.addImportedTypes(importedTypes);
    interfaze.addMethod(method);
}
 
Example #3
Source File: DatabaseIntrospector.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
private void removeIgnoredColumns(TableConfiguration tc,
        Map<ActualTableName, List<IntrospectedColumn>> columns) {
    for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
            .entrySet()) {
        Iterator<IntrospectedColumn> tableColumns = entry.getValue()
                .iterator();
        while (tableColumns.hasNext()) {
            IntrospectedColumn introspectedColumn = tableColumns.next();
            if (tc
                    .isColumnIgnored(introspectedColumn
                            .getActualColumnName())) {
                tableColumns.remove();
                if (logger.isDebugEnabled()) {
                    logger.debug(getString("Tracing.3",
                            introspectedColumn.getActualColumnName(), entry
                                    .getKey().toString()));
                }
            }
        }
    }
}
 
Example #4
Source File: OracleSupport.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
/**
 * 在单条插入动态sql中增加查询序列,以实现oracle主键自增
 *
 * @author 吴帅
 * @parameter @param element
 * @parameter @param introspectedTable
 * @createDate 2015年9月29日 下午12:00:37
 */
@Override
public void adaptInsertSelective(XmlElement element, IntrospectedTable introspectedTable) {
    TableConfiguration tableConfiguration = introspectedTable.getTableConfiguration();
    Properties properties = tableConfiguration.getProperties();
    String incrementFieldName = properties.getProperty("incrementField");
    if (incrementFieldName != null) {// 有自增字段的配置
        List<Element> elements = element.getElements();
        XmlElement selectKey = new XmlElement("selectKey");
        selectKey.addAttribute(new Attribute("keyProperty", incrementFieldName));
        selectKey.addAttribute(new Attribute("resultType", "java.lang.Long"));
        selectKey.addAttribute(new Attribute("order", "BEFORE"));
        selectKey.addElement(new TextElement("select "));
        XmlElement includeSeq = new XmlElement("include");
        includeSeq.addAttribute(new Attribute("refid", "TABLE_SEQUENCE"));
        selectKey.addElement(includeSeq);
        selectKey.addElement(new TextElement(" from dual"));
        elements.add(0, selectKey);
    }
}
 
Example #5
Source File: DatabaseIntrospector.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
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 #6
Source File: DatabaseIntrospector.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
/**
 * @param tc
 * @param columns
 */
private void removeIgnoredColumns(TableConfiguration tc,
        Map<ActualTableName, List<IntrospectedColumn>> columns) {
    for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
            .entrySet()) {
        Iterator<IntrospectedColumn> tableColumns = (entry.getValue())
                .iterator();
        while (tableColumns.hasNext()) {
            IntrospectedColumn introspectedColumn = tableColumns.next();
            if (tc
                    .isColumnIgnored(introspectedColumn
                            .getActualColumnName())) {
                tableColumns.remove();
                if (logger.isDebugEnabled()) {
                    logger.debug(getString("Tracing.3", //$NON-NLS-1$
                            introspectedColumn.getActualColumnName(), entry
                                    .getKey().toString()));
                }
            }
        }
    }
}
 
Example #7
Source File: MyBatisGeneratorConfigurationParser.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
private void parseIgnoreColumnByRegex(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String pattern = attributes.getProperty("pattern");

    IgnoredColumnPattern icPattern = new IgnoredColumnPattern(pattern);

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("except".equals(childNode.getNodeName())) {
            parseException(icPattern, childNode);
        }
    }

    tc.addIgnoredColumnPattern(icPattern);
}
 
Example #8
Source File: TableRenamePlugin.java    From mybatis-generator-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean validate(List<String> warnings) {

    // 如果配置了searchString 或者 replaceString,二者不允许单独存在
    if ((getProperties().getProperty(PRO_SEARCH_STRING) == null && getProperties().getProperty(PRO_REPLACE_STRING) != null)
            || (getProperties().getProperty(PRO_SEARCH_STRING) != null && getProperties().getProperty(PRO_REPLACE_STRING) == null)) {
        warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件的searchString、replaceString属性需配合使用,不能单独存在!");
        return false;
    }

    // 如果table配置了domainObjectName或者mapperName就不要再启动该插件了
    for (TableConfiguration tableConfiguration : context.getTableConfigurations()) {
        if (tableConfiguration.getDomainObjectName() != null || tableConfiguration.getMapperName() != null) {
            warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件请不要配合table的domainObjectName或者mapperName一起使用!");
            return false;
        }
    }

    return super.validate(warnings);
}
 
Example #9
Source File: DatabaseIntrospector.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
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 #10
Source File: IbatorConfigurationParser.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
private void parseIgnoreColumn(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String column = attributes.getProperty("column"); //$NON-NLS-1$
    String delimitedColumnName = attributes
            .getProperty("delimitedColumnName"); //$NON-NLS-1$

    IgnoredColumn ic = new IgnoredColumn(column);

    if (stringHasValue(delimitedColumnName)) {
        ic.setColumnNameDelimited(isTrue(delimitedColumnName));
    }

    tc.addIgnoredColumn(ic);
}
 
Example #11
Source File: IbatorConfigurationParser.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
private void parseColumnRenamingRule(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String searchString = attributes.getProperty("searchString"); //$NON-NLS-1$
    String replaceString = attributes.getProperty("replaceString"); //$NON-NLS-1$

    ColumnRenamingRule crr = new ColumnRenamingRule();

    crr.setSearchString(searchString);

    if (stringHasValue(replaceString)) {
        crr.setReplaceString(replaceString);
    }

    tc.setColumnRenamingRule(crr);
}
 
Example #12
Source File: MyBatisGeneratorConfigurationParser.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
private void parseGeneratedKey(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);

    String column = attributes.getProperty("column"); //$NON-NLS-1$
    boolean identity = isTrue(attributes
            .getProperty("identity")); //$NON-NLS-1$
    String sqlStatement = attributes.getProperty("sqlStatement"); //$NON-NLS-1$
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    GeneratedKey gk = new GeneratedKey(column, sqlStatement, identity, type);

    tc.setGeneratedKey(gk);
}
 
Example #13
Source File: MyBatisGeneratorConfigurationParser.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
private void parseIgnoreColumn(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String column = attributes.getProperty("column"); //$NON-NLS-1$
    String delimitedColumnName = attributes
            .getProperty("delimitedColumnName"); //$NON-NLS-1$

    IgnoredColumn ic = new IgnoredColumn(column);

    if (stringHasValue(delimitedColumnName)) {
        ic.setColumnNameDelimited(isTrue(delimitedColumnName));
    }

    tc.addIgnoredColumn(ic);
}
 
Example #14
Source File: MyBatisGeneratorConfigurationParser.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
private void parseColumnRenamingRule(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String searchString = attributes.getProperty("searchString"); //$NON-NLS-1$
    String replaceString = attributes.getProperty("replaceString"); //$NON-NLS-1$

    ColumnRenamingRule crr = new ColumnRenamingRule();

    crr.setSearchString(searchString);

    if (stringHasValue(replaceString)) {
        crr.setReplaceString(replaceString);
    }

    tc.setColumnRenamingRule(crr);
}
 
Example #15
Source File: DatabaseIntrospector.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
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()));
        }
    }
}
 
Example #16
Source File: ObjectFactory.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
public static IntrospectedTable createIntrospectedTable(
        TableConfiguration tableConfiguration, FullyQualifiedTable table,
        Context context) {

    IntrospectedTable answer = createIntrospectedTableForValidation(context);
    answer.setFullyQualifiedTable(table);
    answer.setTableConfiguration(tableConfiguration);

    return answer;
}
 
Example #17
Source File: IbatorConfigurationParser.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
private void parseGeneratedKey(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);

    String column = attributes.getProperty("column"); //$NON-NLS-1$
    boolean identity = isTrue(attributes
            .getProperty("identity")); //$NON-NLS-1$
    String sqlStatement = attributes.getProperty("sqlStatement"); //$NON-NLS-1$
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    GeneratedKey gk = new GeneratedKey(column, sqlStatement, identity, type);

    tc.setGeneratedKey(gk);
}
 
Example #18
Source File: IbatorConfigurationParser.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
private void parseIgnoreColumn(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String column = attributes.getProperty("column"); //$NON-NLS-1$
    String delimitedColumnName = attributes
            .getProperty("delimitedColumnName"); //$NON-NLS-1$

    IgnoredColumn ic = new IgnoredColumn(column);

    if (stringHasValue(delimitedColumnName)) {
        ic.setColumnNameDelimited(isTrue(delimitedColumnName));
    }

    tc.addIgnoredColumn(ic);
}
 
Example #19
Source File: IbatorConfigurationParser.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
private void parseColumnRenamingRule(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String searchString = attributes.getProperty("searchString"); //$NON-NLS-1$
    String replaceString = attributes.getProperty("replaceString"); //$NON-NLS-1$

    ColumnRenamingRule crr = new ColumnRenamingRule();

    crr.setSearchString(searchString);

    if (stringHasValue(replaceString)) {
        crr.setReplaceString(replaceString);
    }

    tc.setColumnRenamingRule(crr);
}
 
Example #20
Source File: MyBatisGeneratorConfigurationParser.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
private void parseGeneratedKey(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);

    String column = attributes.getProperty("column"); //$NON-NLS-1$
    boolean identity = isTrue(attributes
            .getProperty("identity")); //$NON-NLS-1$
    String sqlStatement = attributes.getProperty("sqlStatement"); //$NON-NLS-1$
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    GeneratedKey gk = new GeneratedKey(column, sqlStatement, identity, type);

    tc.setGeneratedKey(gk);
}
 
Example #21
Source File: MyBatisGeneratorConfigurationParser.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
private void parseIgnoreColumn(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String column = attributes.getProperty("column"); //$NON-NLS-1$
    String delimitedColumnName = attributes
            .getProperty("delimitedColumnName"); //$NON-NLS-1$

    IgnoredColumn ic = new IgnoredColumn(column);

    if (stringHasValue(delimitedColumnName)) {
        ic.setColumnNameDelimited(isTrue(delimitedColumnName));
    }

    tc.addIgnoredColumn(ic);
}
 
Example #22
Source File: MyBatisGeneratorConfigurationParser.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
private void parseColumnRenamingRule(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String searchString = attributes.getProperty("searchString"); //$NON-NLS-1$
    String replaceString = attributes.getProperty("replaceString"); //$NON-NLS-1$

    ColumnRenamingRule crr = new ColumnRenamingRule();

    crr.setSearchString(searchString);

    if (stringHasValue(replaceString)) {
        crr.setReplaceString(replaceString);
    }

    tc.setColumnRenamingRule(crr);
}
 
Example #23
Source File: DatabaseIntrospector.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
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 #24
Source File: JavaBeansUtil.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
private static boolean isTrimStringsEnabled(IntrospectedTable table) {
    TableConfiguration tableConfiguration = table.getTableConfiguration();
    String trimSpaces = tableConfiguration.getProperties().getProperty(
            PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS);
    if (trimSpaces != null) {
        return isTrue(trimSpaces);
    }
    return isTrimStringsEnabled(table.getContext());
}
 
Example #25
Source File: TablePrefixPlugin.java    From mybatis-generator-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean validate(List<String> warnings) {
    // 如果table配置了domainObjectName或者mapperName就不要再启动该插件了
    for (TableConfiguration tableConfiguration : context.getTableConfigurations()) {
        if (tableConfiguration.getDomainObjectName() != null || tableConfiguration.getMapperName() != null) {
            warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件请不要配合table的domainObjectName或者mapperName一起使用!");
            return false;
        }
    }

    return super.validate(warnings);
}
 
Example #26
Source File: TableRenameConfigurationPlugin.java    From mybatis-generator-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * column rename
 * @param columns
 * @param rule
 * @param tc
 */
private void renameColumns(List<IntrospectedColumn> columns, ColumnRenamingRule rule, TableConfiguration tc) {
    Pattern pattern = Pattern.compile(rule.getSearchString());
    String replaceString = rule.getReplaceString();
    replaceString = replaceString == null ? "" : replaceString;

    for (IntrospectedColumn introspectedColumn : columns) {
        String calculatedColumnName;
        if (pattern == null) {
            calculatedColumnName = introspectedColumn.getActualColumnName();
        } else {
            Matcher matcher = pattern.matcher(introspectedColumn.getActualColumnName());
            calculatedColumnName = matcher.replaceAll(replaceString);
        }

        if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_ACTUAL_COLUMN_NAMES))) {
            introspectedColumn.setJavaProperty(getValidPropertyName(calculatedColumnName));
        } else if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_COMPOUND_PROPERTY_NAMES))) {
            StringBuilder sb = new StringBuilder();
            sb.append(calculatedColumnName);
            sb.append('_');
            sb.append(getCamelCaseString(introspectedColumn.getRemarks(), true));
            introspectedColumn.setJavaProperty(getValidPropertyName(sb.toString()));
        } else {
            introspectedColumn.setJavaProperty(getCamelCaseString(calculatedColumnName, false));
        }
    }
}
 
Example #27
Source File: MyBatisGeneratorConfigurationParser.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
private void parseGeneratedKey(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);

    String column = attributes.getProperty("column");
    boolean identity = isTrue(attributes
            .getProperty("identity"));
    String sqlStatement = attributes.getProperty("sqlStatement");
    String type = attributes.getProperty("type");

    GeneratedKey gk = new GeneratedKey(column, sqlStatement, identity, type);

    tc.setGeneratedKey(gk);
}
 
Example #28
Source File: MyBatisGeneratorConfigurationParser.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
private void parseColumnRenamingRule(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String searchString = attributes.getProperty("searchString");
    String replaceString = attributes.getProperty("replaceString");

    ColumnRenamingRule crr = new ColumnRenamingRule();

    crr.setSearchString(searchString);

    if (stringHasValue(replaceString)) {
        crr.setReplaceString(replaceString);
    }

    tc.setColumnRenamingRule(crr);
}
 
Example #29
Source File: IbatorConfigurationParser.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
private void parseGeneratedKey(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);

    String column = attributes.getProperty("column"); //$NON-NLS-1$
    boolean identity = isTrue(attributes
            .getProperty("identity")); //$NON-NLS-1$
    String sqlStatement = attributes.getProperty("sqlStatement"); //$NON-NLS-1$
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    GeneratedKey gk = new GeneratedKey(column, sqlStatement, identity, type);

    tc.setGeneratedKey(gk);
}
 
Example #30
Source File: MyBatisGeneratorConfigurationParser.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
private void parseIgnoreColumn(TableConfiguration tc, Node node) {
    Properties attributes = parseAttributes(node);
    String column = attributes.getProperty("column");
    String delimitedColumnName = attributes
            .getProperty("delimitedColumnName");

    IgnoredColumn ic = new IgnoredColumn(column);

    if (stringHasValue(delimitedColumnName)) {
        ic.setColumnNameDelimited(isTrue(delimitedColumnName));
    }

    tc.addIgnoredColumn(ic);
}