int index = table.indexOf('.'); if (index < 0) addAttribute("name", table); else { addAttribute("schema", table.substring(0, index)); addAttribute("name", table.substring(index + 1));
/** * Serialize order column. */ protected void serializeOrderColumn(FieldMetaData fmd) throws SAXException { FieldMapping field = (FieldMapping) fmd; Column orderCol = field.getOrderColumn(); if (orderCol != null) { if (orderCol.getName() != null) addAttribute("name", orderCol.getName()); if (orderCol.isNotNull()) addAttribute("nullable", "false"); if (orderCol.getFlag(Column.FLAG_UNINSERTABLE)) addAttribute("insertable", "false"); if (orderCol.getFlag(Column.FLAG_UNUPDATABLE)) addAttribute("updatable", "false"); if (orderCol.getTypeName() != null) addAttribute("column-definition", orderCol.getTypeName()); startElement("order-column"); endElement("order-column"); } }
/** * Serialize order column. */ protected void serializeOrderColumn(FieldMetaData fmd) throws SAXException { FieldMapping field = (FieldMapping) fmd; Column orderCol = field.getOrderColumn(); if (orderCol != null) { if (orderCol.getName() != null) addAttribute("name", orderCol.getName()); if (orderCol.isNotNull()) addAttribute("nullable", "false"); if (orderCol.getFlag(Column.FLAG_UNINSERTABLE)) addAttribute("insertable", "false"); if (orderCol.getFlag(Column.FLAG_UNUPDATABLE)) addAttribute("updatable", "false"); if (orderCol.getTypeName() != null) addAttribute("column-definition", orderCol.getTypeName()); startElement("order-column"); endElement("order-column"); } }
/** * Serialize order column. */ protected void serializeOrderColumn(FieldMetaData fmd) throws SAXException { FieldMapping field = (FieldMapping) fmd; Column orderCol = field.getOrderColumn(); if (orderCol != null) { if (orderCol.getName() != null) addAttribute("name", orderCol.getName()); if (orderCol.isNotNull()) addAttribute("nullable", "false"); if (orderCol.getFlag(Column.FLAG_UNINSERTABLE)) addAttribute("insertable", "false"); if (orderCol.getFlag(Column.FLAG_UNUPDATABLE)) addAttribute("updatable", "false"); if (orderCol.getTypeName() != null) addAttribute("column-definition", orderCol.getTypeName()); startElement("order-column"); endElement("order-column"); } }
throws SAXException { if (col.getName() != null) addAttribute("name", col.getName()); if (col.getTypeName() != null) addAttribute("column-definition", col.getTypeName()); if (col.getTarget() != null && (type == ColType.JOIN || type == ColType.INVERSE || type == ColType.PK_JOIN)) addAttribute("referenced-column-name", col.getTarget()); if (type == ColType.COL || type == ColType.JOIN || type == ColType.PK_JOIN) { if (unique) addAttribute("unique", "true"); if (col.isNotNull()) addAttribute("nullable", "false"); if (col.getFlag(Column.FLAG_UNINSERTABLE)) addAttribute("insertable", "false"); if (col.getFlag(Column.FLAG_UNUPDATABLE)) addAttribute("updatable", "false"); if (secondary != null) addAttribute("table", secondary); addAttribute("length", col.getSize() + ""); if (col.getDecimalDigits() != 0) addAttribute("scale", col.getDecimalDigits() + "");
addAttribute("name", seq.getName()); String table = seq.getTable(); if (table != null) { int dotIdx = table.indexOf('.'); if (dotIdx == -1) addAttribute("table", table); else { addAttribute("table", table.substring(dotIdx + 1)); addAttribute("schema", table.substring(0, dotIdx)); addAttribute("pk-column-name", seq.getPrimaryKeyColumn()); if (!StringUtils.isEmpty(seq.getSequenceColumn())) addAttribute("value-column-name", seq.getSequenceColumn()); if (!StringUtils.isEmpty(seq.getPrimaryKeyValue())) addAttribute("pk-column-value", seq.getPrimaryKeyValue()); if (seq.getAllocate() != 50 && seq.getAllocate() != -1) addAttribute("allocation-size", seq.getAllocate() + ""); if (seq.getInitialValue() != 0 && seq.getInitialValue() != -1) addAttribute("initial-value", seq.getInitialValue() + ""); startElement("table-generator"); endElement("table-generator");
addAttribute("name", seq.getName()); String table = seq.getTable(); if (table != null) { int dotIdx = table.indexOf('.'); if (dotIdx == -1) addAttribute("table", table); else { addAttribute("table", table.substring(dotIdx + 1)); addAttribute("schema", table.substring(0, dotIdx)); addAttribute("pk-column-name", seq.getPrimaryKeyColumn()); if (!StringUtils.isEmpty(seq.getSequenceColumn())) addAttribute("value-column-name", seq.getSequenceColumn()); if (!StringUtils.isEmpty(seq.getPrimaryKeyValue())) addAttribute("pk-column-value", seq.getPrimaryKeyValue()); if (seq.getAllocate() != 50 && seq.getAllocate() != -1) addAttribute("allocation-size", seq.getAllocate() + ""); if (seq.getInitialValue() != 0 && seq.getInitialValue() != -1) addAttribute("initial-value", seq.getInitialValue() + ""); startElement("table-generator"); endElement("table-generator");
return; addAttribute("name", meta.getName()); startElement("sql-result-set-mapping"); for (QueryResultMapping.PCResult pc : meta.getPCResults()) { addAttribute("entity-class", pc.getCandidateType().getName()); Object discrim = pc.getMapping(pc.DISCRIMINATOR); if (discrim != null) addAttribute("discriminator-column", discrim.toString()); addAttribute("name", path); addAttribute("column", pc.getMapping(path).toString()); startElement("field-result"); endElement("field-result"); addAttribute("name", col.toString()); startElement("column-result"); endElement("column-result");
addAttribute("name", seq.getName()); String table = seq.getTable(); if (table != null) { int dotIdx = table.indexOf('.'); if (dotIdx == -1) addAttribute("table", table); else { addAttribute("table", table.substring(dotIdx + 1)); addAttribute("schema", table.substring(0, dotIdx)); addAttribute("pk-column-name", seq.getPrimaryKeyColumn()); if (!StringUtil.isEmpty(seq.getSequenceColumn())) addAttribute("value-column-name", seq.getSequenceColumn()); if (!StringUtil.isEmpty(seq.getPrimaryKeyValue())) addAttribute("pk-column-value", seq.getPrimaryKeyValue()); if (seq.getAllocate() != 50 && seq.getAllocate() != -1) addAttribute("allocation-size", seq.getAllocate() + ""); if (seq.getInitialValue() != 0 && seq.getInitialValue() != -1) addAttribute("initial-value", seq.getInitialValue() + ""); startElement("table-generator"); endElement("table-generator");
return; addAttribute("name", meta.getName()); startElement("sql-result-set-mapping"); for (QueryResultMapping.PCResult pc : meta.getPCResults()) { addAttribute("entity-class", pc.getCandidateType().getName()); Object discrim = pc.getMapping(pc.DISCRIMINATOR); if (discrim != null) addAttribute("discriminator-column", discrim.toString()); addAttribute("name", path); addAttribute("column", pc.getMapping(path).toString()); startElement("field-result"); endElement("field-result"); addAttribute("name", col.toString()); startElement("column-result"); endElement("column-result");
return; addAttribute("name", meta.getName()); startElement("sql-result-set-mapping"); for (QueryResultMapping.PCResult pc : meta.getPCResults()) { addAttribute("entity-class", pc.getCandidateType().getName()); Object discrim = pc.getMapping(pc.DISCRIMINATOR); if (discrim != null) addAttribute("discriminator-column", discrim.toString()); addAttribute("name", path); addAttribute("column", pc.getMapping(path).toString()); startElement("field-result"); endElement("field-result"); addAttribute("name", col.toString()); startElement("column-result"); endElement("column-result");
addAttribute("name", seq.getName()); String table = seq.getTable(); if (table != null) { int dotIdx = table.indexOf('.'); if (dotIdx == -1) addAttribute("table", table); else { addAttribute("table", table.substring(dotIdx + 1)); addAttribute("schema", table.substring(0, dotIdx)); addAttribute("pk-column-name", seq.getPrimaryKeyColumn()); if (!StringUtil.isEmpty(seq.getSequenceColumn())) addAttribute("value-column-name", seq.getSequenceColumn()); if (!StringUtil.isEmpty(seq.getPrimaryKeyValue())) addAttribute("pk-column-value", seq.getPrimaryKeyValue()); if (seq.getAllocate() != 50 && seq.getAllocate() != -1) addAttribute("allocation-size", seq.getAllocate() + ""); if (seq.getInitialValue() != 0 && seq.getInitialValue() != -1) addAttribute("initial-value", seq.getInitialValue() + ""); startElement("table-generator"); endElement("table-generator");
return; addAttribute("name", meta.getName()); startElement("sql-result-set-mapping"); for (QueryResultMapping.PCResult pc : meta.getPCResults()) { addAttribute("entity-class", pc.getCandidateType().getName()); Object discrim = pc.getMapping(pc.DISCRIMINATOR); if (discrim != null) addAttribute("discriminator-column", discrim.toString()); addAttribute("name", path); addAttribute("column", pc.getMapping(path).toString()); startElement("field-result"); endElement("field-result"); addAttribute("name", col.toString()); startElement("column-result"); endElement("column-result");
@Override protected void serializeInheritanceContent(ClassMetaData mapping) throws SAXException { ClassMapping cls = (ClassMapping) mapping; ClassMappingInfo info = cls.getMappingInfo(); DiscriminatorMappingInfo dinfo = cls.getDiscriminator() .getMappingInfo(); String strat = info.getHierarchyStrategy(); if (FlatClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "SINGLE_TABLE"); else if (VerticalClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "JOINED"); else if (FullClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "TABLE_PER_CLASS"); if (strat != null) { startElement("inheritance"); endElement("inheritance"); } if (dinfo.getValue() != null) { startElement("discriminator-value"); addText(dinfo.getValue()); endElement("discriminator-value"); } serializeColumns(dinfo, ColType.DISC, null); }
@Override protected void serializeInheritanceContent(ClassMetaData mapping) throws SAXException { ClassMapping cls = (ClassMapping) mapping; ClassMappingInfo info = cls.getMappingInfo(); DiscriminatorMappingInfo dinfo = cls.getDiscriminator() .getMappingInfo(); String strat = info.getHierarchyStrategy(); if (FlatClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "SINGLE_TABLE"); else if (VerticalClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "JOINED"); else if (FullClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "TABLE_PER_CLASS"); if (strat != null) { startElement("inheritance"); endElement("inheritance"); } if (dinfo.getValue() != null) { startElement("discriminator-value"); addText(dinfo.getValue()); endElement("discriminator-value"); } serializeColumns(dinfo, ColType.DISC, null); }
@Override protected void serializeInheritanceContent(ClassMetaData mapping) throws SAXException { ClassMapping cls = (ClassMapping) mapping; ClassMappingInfo info = cls.getMappingInfo(); DiscriminatorMappingInfo dinfo = cls.getDiscriminator() .getMappingInfo(); String strat = info.getHierarchyStrategy(); if (FlatClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "SINGLE_TABLE"); else if (VerticalClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "JOINED"); else if (FullClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "TABLE_PER_CLASS"); if (strat != null) { startElement("inheritance"); endElement("inheritance"); } if (dinfo.getValue() != null) { startElement("discriminator-value"); addText(dinfo.getValue()); endElement("discriminator-value"); } serializeColumns(dinfo, ColType.DISC, null); }
@Override protected void serializeInheritanceContent(ClassMetaData mapping) throws SAXException { ClassMapping cls = (ClassMapping) mapping; ClassMappingInfo info = cls.getMappingInfo(); DiscriminatorMappingInfo dinfo = cls.getDiscriminator() .getMappingInfo(); String strat = info.getHierarchyStrategy(); if (FlatClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "SINGLE_TABLE"); else if (VerticalClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "JOINED"); else if (FullClassStrategy.ALIAS.equals(strat)) addAttribute("strategy", "TABLE_PER_CLASS"); if (strat != null) { startElement("inheritance"); endElement("inheritance"); } if (dinfo.getValue() != null) { startElement("discriminator-value"); addText(dinfo.getValue()); endElement("discriminator-value"); } serializeColumns(dinfo, ColType.DISC, null); }
private void serializeUniqueConstraint(Unique unique) throws SAXException { if (StringUtils.isNotEmpty(unique.getName())) { addAttribute("name", unique.getName()); } startElement("unique-constraint"); Column[] columns = unique.getColumns(); for (Column column:columns) { startElement("column-name"); addText(column.getName()); endElement("column-name"); } endElement("unique-constraint"); }
private void serializeUniqueConstraint(Unique unique) throws SAXException { if (StringUtil.isNotEmpty(unique.getName())) { addAttribute("name", unique.getName()); } startElement("unique-constraint"); Column[] columns = unique.getColumns(); for (Column column:columns) { startElement("column-name"); addText(column.getName()); endElement("column-name"); } endElement("unique-constraint"); }
private void serializeUniqueConstraint(Unique unique) throws SAXException { if (StringUtil.isNotEmpty(unique.getName())) { addAttribute("name", unique.getName()); } startElement("unique-constraint"); Column[] columns = unique.getColumns(); for (Column column:columns) { startElement("column-name"); addText(column.getName()); endElement("column-name"); } endElement("unique-constraint"); }