private Element generateRevisionInfoRelationMapping() { Document document = XMLHelper.getDocumentFactory().createDocument(); Element rev_rel_mapping = document.addElement("key-many-to-one"); rev_rel_mapping.addAttribute("type", revisionPropType); rev_rel_mapping.addAttribute("class", revisionInfoEntityName); if (revisionPropSqlType != null) { // Putting a fake name to make Hibernate happy. It will be replaced later anyway. MetadataTools.addColumn( rev_rel_mapping, "*", null, 0, 0, revisionPropSqlType, null, null, false); } return rev_rel_mapping; }
private Document generateDefaultRevisionInfoXmlMapping() { Document document = XMLHelper.getDocumentFactory().createDocument(); Element class_mapping = MetadataTools.createEntity( document, new AuditTableData( null, null, globalCfg.getDefaultSchemaName(), globalCfg.getDefaultCatalogName()), null); class_mapping.addAttribute("name", revisionInfoEntityName); class_mapping.addAttribute("table", "REVINFO"); Element idProperty = MetadataTools.addNativelyGeneratedId( class_mapping, revisionInfoIdData.getName(), revisionPropType); MetadataTools.addColumn(idProperty, "REV", null, 0, 0, null, null, null, false); Element timestampProperty = MetadataTools.addProperty( class_mapping, revisionInfoTimestampData.getName(), revisionInfoTimestampType.getName(), true, false); MetadataTools.addColumn(timestampProperty, "REVTSTMP", null, 0, 0, null, null, null, false); if (globalCfg.isTrackEntitiesChangedInRevisionEnabled()) { generateEntityNamesTrackingTableMapping( class_mapping, "modifiedEntityNames", globalCfg.getDefaultSchemaName(), globalCfg.getDefaultCatalogName(), "REVCHANGES", "REV", "ENTITYNAME", "string"); } return document; }