Example usage for org.hibernate.mapping Table getSubselect

List of usage examples for org.hibernate.mapping Table getSubselect

Introduction

In this page you can find the example usage for org.hibernate.mapping Table getSubselect.

Prototype

public String getSubselect() 

Source Link

Usage

From source file:com.blazebit.persistence.integration.hibernate.base.SimpleDatabase.java

License:Apache License

public SimpleDatabase(Iterator<Table> iter, Dialect dialect, TableNameFormatter formatter, Mapping mapping) {
    Map<String, Table> map = new HashMap<String, Table>();
    while (iter.hasNext()) {
        Table t = iter.next();
        map.put(formatter.getQualifiedTableName(dialect, t), t);
        if (t.getSubselect() != null) {
            map.put("( " + t.getSubselect() + " )", t);
        }/* w  w w  .j ava2 s  . c om*/
        Iterator<Column> columnIter = t.getColumnIterator();
        while (columnIter.hasNext()) {
            final Column column = columnIter.next();
            column.getSqlType(dialect, mapping);
        }
    }
    this.tables = Collections.unmodifiableMap(map);
}

From source file:com.zutubi.pulse.master.hibernate.MutableConfiguration.java

License:Apache License

private String getTableKey(Table table) {
    return table.getSubselect() == null ? Table.qualify(table.getCatalog(), table.getSchema(), table.getName())
            : table.getSubselect();/*from  ww  w.j a  v a  2s  . com*/
}

From source file:com.zutubi.pulse.master.hibernate.SchemaRefactor.java

License:Apache License

protected Table clone(Table table) {
    Table clone = new Table(table.getName());
    clone.setAbstract(table.isAbstract());
    clone.setCatalog(table.getCatalog());
    clone.setComment(table.getComment());
    clone.setName(table.getName());/*  ww w.  jav  a2 s. co m*/
    clone.setPrimaryKey(table.getPrimaryKey());
    clone.setQuoted(table.isQuoted());
    clone.setRowId(table.getRowId());
    clone.setSchema(table.getSchema());
    clone.setSubselect(table.getSubselect());

    Iterator columns = table.getColumnIterator();
    while (columns.hasNext()) {
        Column column = (Column) columns.next();
        clone.addColumn(column);
    }

    Iterator foreignKeys = table.getForeignKeyIterator();
    while (foreignKeys.hasNext()) {
        ForeignKey key = (ForeignKey) foreignKeys.next();
        clone.createForeignKey(key.getName(), key.getColumns(), key.getReferencedEntityName(),
                key.getReferencedColumns());
    }

    return clone;
}

From source file:org.jboss.tools.hibernate.ui.diagram.editors.model.OrmShape.java

License:Open Source License

@Override
public Object getPropertyValue(Object propertyId) {
    Object res = null;//from ww  w  .  j  a  va 2 s .  com
    RootClass rootClass = null;
    Table table = null;
    Object ormElement = getOrmElement();
    if (ormElement instanceof RootClass) {
        rootClass = (RootClass) ormElement;
    } else if (ormElement instanceof Subclass) {
        //rootClass = ((Subclass)ormElement).getRootClass();
    } else if (ormElement instanceof Table) {
        table = (Table) getOrmElement();
    }
    if (rootClass != null) {
        if (ENTITY_isAbstract.equals(propertyId)) {
            if (rootClass.isAbstract() != null) {
                res = rootClass.isAbstract().toString();
            }
        } else if (ENTITY_isCustomDeleteCallable.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isCustomDeleteCallable()).toString();
        } else if (ENTITY_isCustomInsertCallable.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isCustomInsertCallable()).toString();
        } else if (ENTITY_isCustomUpdateCallable.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isCustomUpdateCallable()).toString();
        } else if (ENTITY_isDiscriminatorInsertable.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isDiscriminatorInsertable()).toString();
        } else if (ENTITY_isDiscriminatorValueNotNull.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isDiscriminatorValueNotNull()).toString();
        } else if (ENTITY_isDiscriminatorValueNull.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isDiscriminatorValueNull()).toString();
        } else if (ENTITY_isExplicitPolymorphism.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isExplicitPolymorphism()).toString();
        } else if (ENTITY_isForceDiscriminator.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isForceDiscriminator()).toString();
        } else if (ENTITY_isInherited.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isInherited()).toString();
        } else if (ENTITY_isJoinedSubclass.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isJoinedSubclass()).toString();
        } else if (ENTITY_isLazy.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isLazy()).toString();
        } else if (ENTITY_isLazyPropertiesCacheable.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isLazyPropertiesCacheable()).toString();
        } else if (ENTITY_isMutable.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isMutable()).toString();
        } else if (ENTITY_isPolymorphic.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isPolymorphic()).toString();
        } else if (ENTITY_isVersioned.equals(propertyId)) {
            res = Boolean.valueOf(rootClass.isVersioned()).toString();
        } else if (ENTITY_batchSize.equals(propertyId)) {
            res = Integer.valueOf(rootClass.getBatchSize()).toString();
        } else if (ENTITY_cacheConcurrencyStrategy.equals(propertyId)) {
            res = rootClass.getCacheConcurrencyStrategy();
        } else if (ENTITY_className.equals(propertyId)) {
            res = rootClass.getClassName();
        } else if (ENTITY_customSQLDelete.equals(propertyId)) {
            res = rootClass.getCustomSQLDelete();
        } else if (ENTITY_customSQLInsert.equals(propertyId)) {
            res = rootClass.getCustomSQLInsert();
        } else if (ENTITY_customSQLUpdate.equals(propertyId)) {
            res = rootClass.getCustomSQLUpdate();
        } else if (ENTITY_discriminatorValue.equals(propertyId)) {
            res = rootClass.getDiscriminatorValue();
        } else if (ENTITY_entityName.equals(propertyId)) {
            res = rootClass.getEntityName();
        } else if (ENTITY_loaderName.equals(propertyId)) {
            res = rootClass.getLoaderName();
        } else if (ENTITY_nodeName.equals(propertyId)) {
            res = rootClass.getNodeName();
        } else if (ENTITY_optimisticLockMode.equals(propertyId)) {
            res = Integer.valueOf(rootClass.getOptimisticLockMode()).toString();
        } else if (ENTITY_table.equals(propertyId)) {
            if (rootClass.getTable() != null) {
                res = rootClass.getTable().getName();
            }
        } else if (ENTITY_temporaryIdTableDDL.equals(propertyId)) {
            res = rootClass.getTemporaryIdTableDDL();
        } else if (ENTITY_temporaryIdTableName.equals(propertyId)) {
            res = rootClass.getTemporaryIdTableName();
        } else if (ENTITY_where.equals(propertyId)) {
            res = rootClass.getWhere();
        }
    }
    if (table != null) {
        if (TABLE_catalog.equals(propertyId)) {
            res = table.getCatalog();
        } else if (TABLE_comment.equals(propertyId)) {
            res = table.getComment();
        } else if (TABLE_name.equals(propertyId)) {
            res = table.getName();
        } else if (TABLE_primaryKey.equals(propertyId)) {
            if (table.getPrimaryKey() != null) {
                res = table.getPrimaryKey().getName();
            }
        } else if (TABLE_rowId.equals(propertyId)) {
            res = table.getRowId();
        } else if (TABLE_schema.equals(propertyId)) {
            res = table.getSchema();
        } else if (TABLE_subselect.equals(propertyId)) {
            res = table.getSubselect();
        } else if (TABLE_hasDenormalizedTables.equals(propertyId)) {
            res = Boolean.valueOf(table.hasDenormalizedTables()).toString();
        } else if (TABLE_isAbstract.equals(propertyId)) {
            res = Boolean.valueOf(table.isAbstract()).toString();
        } else if (TABLE_isAbstractUnionTable.equals(propertyId)) {
            res = Boolean.valueOf(table.isAbstractUnionTable()).toString();
        } else if (TABLE_isPhysicalTable.equals(propertyId)) {
            res = Boolean.valueOf(table.isPhysicalTable()).toString();
        }
    }
    if (res == null) {
        res = super.getPropertyValue(propertyId);
    }
    return toEmptyStr(res);
}