Example usage for org.hibernate.mapping ForeignKey getColumn

List of usage examples for org.hibernate.mapping ForeignKey getColumn

Introduction

In this page you can find the example usage for org.hibernate.mapping ForeignKey getColumn.

Prototype

public Column getColumn(int i) 

Source Link

Usage

From source file:com.netspective.tool.hibernate.document.diagram.HibernateDiagramTableStructureNodeGenerator.java

License:Open Source License

public String getEdgeSourceElementAndPort(final HibernateDiagramGenerator generator,
        final HibernateDiagramGeneratorFilter filter, final ForeignKey foreignKey) {
    // the subclass will point to the superclass and be formatted as a "back" reference to properly set the weight
    if (filter.isShowClassStructure(generator, foreignKey) && generator.isSubclassRelationship(foreignKey))
        return foreignKey.getReferencedTable().getName();

    // for parents, we put the crow arrow pointing to us (the source becomes the parent, not the child -- this way it will look like a tree)
    if (generator.isParentRelationship(foreignKey))
        return foreignKey.getReferencedTable().getName();

    return filter.isIncludeEdgePort(generator, foreignKey, true)
            ? (foreignKey.getTable().getName() + ":"
                    + (showConstraints/*from w  ww .  j  ava  2  s. c om*/
                            ? (foreignKey.getColumn(0).getName()
                                    + HibernateDiagramFilter.COLUMN_PORT_NAME_CONSTRAINT_SUFFIX)
                            : foreignKey.getColumn(0).getName()))
            : foreignKey.getTable().getName();

}

From source file:com.siemens.scr.avt.ad.query.common.NaturalJoinTreeLoadingStrategy.java

License:Open Source License

private void processFKs(NaturalJoinTree tree, Set<ForeignKey> fks) {
    for (ForeignKey fk : fks) {
        assert fk.getColumnSpan() == 1;// we do not allow composite FK for now
        String columnName = fk.getColumn(0).getName();
        Table contextTable = fk.getTable();
        String table = tableNameFromTable(contextTable);
        String entityName = fk.getReferencedEntityName();
        PersistentClass referencedPC = getConfig().getClassMapping(entityName);
        String referencedTable = tableNameFromPersistentClass(referencedPC);
        tree.handleFK(table, referencedTable, columnName);
    }//from  w w w .  java  2  s . c  o m

}

From source file:org.sns.tool.hibernate.document.diagram.HibernateDiagramTableStructureNodeGenerator.java

License:Open Source License

public String getEdgeSourceElementAndPort(final HibernateDiagramGenerator generator,
        final HibernateDiagramGeneratorFilter filter, final ForeignKey foreignKey) {
    // the subclass will point to the superclass and be formatted as a "back" reference to properly set the weight
    if (filter.isShowClassStructure(generator, foreignKey) && generator.isSubclassRelationship(foreignKey))
        return foreignKey.getReferencedTable().getName();

    // for parents, we put the crow arrow pointing to us (the source becomes the parent, not the child -- this way it will look like a tree)
    if (generator.isParentRelationship(foreignKey))
        return foreignKey.getReferencedTable().getName();

    return filter.isIncludeEdgePort(generator, foreignKey, true)
            ? (foreignKey.getTable().getName() + ":"
                    + (showConstraints/*  w  ww.ja va  2 s .  co  m*/
                            ? (foreignKey.getColumn(0).getName()
                                    + HibernateDiagramGeneratorFilter.COLUMN_PORT_NAME_CONSTRAINT_SUFFIX)
                            : foreignKey.getColumn(0).getName()))
            : foreignKey.getTable().getName();

}