• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DatabaseTable类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.eclipse.persistence.internal.helper.DatabaseTable的典型用法代码示例。如果您正苦于以下问题:Java DatabaseTable类的具体用法?Java DatabaseTable怎么用?Java DatabaseTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DatabaseTable类属于org.eclipse.persistence.internal.helper包,在下文中一共展示了DatabaseTable类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: customize

点赞 3

import org.eclipse.persistence.internal.helper.DatabaseTable; //导入依赖的package包/类
@Override
public void customize(Session session) throws Exception {
    for (ClassDescriptor descriptor : session.getDescriptors().values()) {
        if (!descriptor.getTables().isEmpty() && descriptor.getAlias().equalsIgnoreCase(descriptor.getTableName())) {
            String tableName = addUnderscores(descriptor.getAlias()).toUpperCase();
            System.out.println(descriptor.getAlias() + ":" + tableName);
            descriptor.setTableName(tableName);

            DatabaseTable databaseTable = descriptor.getTables().get(0);
            for (IndexDefinition indexDef : databaseTable.getIndexes()) {
                indexDef.setTargetTable(tableName);
            }
        }

        for (DatabaseMapping mapping : descriptor.getMappings()) {
            if (mapping.getField() != null
                    && !mapping.getAttributeName().isEmpty()
                    && mapping.getField().getName().equalsIgnoreCase(mapping.getAttributeName())) {
                mapping.getField().setName(
                        addUnderscores(mapping.getAttributeName()).toUpperCase()
                );
            }
        }
    }
}
 

开发者ID:kawasima,
项目名称:occupy-pub,
代码行数:26,
代码来源:SnakeCaseNameMapping.java

示例2: customize

点赞 3

import org.eclipse.persistence.internal.helper.DatabaseTable; //导入依赖的package包/类
@Override
public void customize(final Session session) throws Exception {
    if (JPAThreadContext.infos.containsKey("properties")) {
        final String prefix = ((Properties) JPAThreadContext.infos.get("properties")).getProperty("openejb.jpa.table_prefix");
        final List<DatabaseTable> tables = new ArrayList<DatabaseTable>();
        for (final ClassDescriptor cd : session.getDescriptors().values()) {
            for (final DatabaseTable table : cd.getTables()) {
                update(prefix, tables, table);
            }
            for (final DatabaseMapping mapping : cd.getMappings()) {
                if (mapping instanceof ManyToManyMapping) {
                    update(prefix, tables, ((ManyToManyMapping) mapping).getRelationTable());
                } else if (mapping instanceof DirectCollectionMapping) {
                    update(prefix, tables, ((DirectCollectionMapping) mapping).getReferenceTable());
                } // TODO: else check we need to update something
            }
        }

        final Sequence sequence = session.getDatasourcePlatform().getDefaultSequence();
        if (sequence instanceof TableSequence) {
            final TableSequence ts = ((TableSequence) sequence);
            ts.setName(prefix + ts.getName());
        }
    }
}
 

开发者ID:apache,
项目名称:tomee,
代码行数:26,
代码来源:PrefixSessionCustomizer.java

示例3: addMultipleTableKeyFields

点赞 2

import org.eclipse.persistence.internal.helper.DatabaseTable; //导入依赖的package包/类
@Override
 protected void addMultipleTableKeyFields(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns, DatabaseTable targetTable, String PK_CTX, String FK_CTX) {
    try {
        super.addMultipleTableKeyFields(primaryKeyJoinColumns, targetTable, PK_CTX, FK_CTX);
    } catch (ValidationException ex) {// to handle @PrimaryKeyJoinColumn exception
        DBValidationException exception = new DBValidationException(ex);
        exception.setJavaClass(entity);
        throw exception;
    }
}
 

开发者ID:jeddict,
项目名称:jCode,
代码行数:11,
代码来源:EntitySpecAccessor.java

示例4: getTableDefFromDBTable

点赞 2

import org.eclipse.persistence.internal.helper.DatabaseTable; //导入依赖的package包/类
protected TableDefinition getTableDefFromDBTable(ManagedClass managedClass, Attribute managedAttribute, LinkedList<Entity> intrinsicEntity, DatabaseTable databaseTable) {
    JPAMTableDefinition tableDefinition = this.tableMap.get(databaseTable.getName());

    if (tableDefinition == null) {
        //table not built yet, simply built it
        String tableName = databaseTable.getNameDelimited(databasePlatform);
        tableDefinition = new JPAMTableDefinition(managedClass, managedAttribute, intrinsicEntity);
        tableDefinition.setTable(databaseTable);
        tableDefinition.setName(tableName);
        tableDefinition.setQualifier(databaseTable.getTableQualifier());
        if (databaseTable.hasUniqueConstraints()) {
            addUniqueKeyConstraints(tableDefinition, databaseTable.getUniqueConstraints());
        }
        if (databaseTable.hasIndexes()) {
            tableDefinition.getIndexes().addAll(databaseTable.getIndexes());
        }
        if (databaseTable.getCreationSuffix() != null) {
            tableDefinition.setCreationSuffix(databaseTable.getCreationSuffix());
        }

        // Add the foreign key constraints that were set on the table.
        if (databaseTable.hasForeignKeyConstraints()) {
            tableDefinition.setUserDefinedForeignKeyConstraints(databaseTable.getForeignKeyConstraints());
        }

        tableMap.put(databaseTable.getName(), tableDefinition);
    }

    return tableDefinition;
}
 

开发者ID:jeddict,
项目名称:jeddict,
代码行数:31,
代码来源:JPAMDefaultTableGenerator.java

示例5: update

点赞 2

import org.eclipse.persistence.internal.helper.DatabaseTable; //导入依赖的package包/类
private void update(final String prefix, final List<DatabaseTable> tables, final DatabaseTable table) {
    if (!tables.contains(table)) {
        table.setName(prefix + table.getName());
        tables.add(table);
    }
}
 

开发者ID:apache,
项目名称:tomee,
代码行数:7,
代码来源:PrefixSessionCustomizer.java

示例6: getTable

点赞 2

import org.eclipse.persistence.internal.helper.DatabaseTable; //导入依赖的package包/类
public DatabaseTable getTable() {
    return table;
}
 

开发者ID:jmrunge,
项目名称:osiris-platform,
代码行数:4,
代码来源:TableSequence.java

示例7: setTable

点赞 2

import org.eclipse.persistence.internal.helper.DatabaseTable; //导入依赖的package包/类
public void setTable(DatabaseTable table) {
    this.table = table;
}
 

开发者ID:jmrunge,
项目名称:osiris-platform,
代码行数:4,
代码来源:TableSequence.java

示例8: setTableName

点赞 2

import org.eclipse.persistence.internal.helper.DatabaseTable; //导入依赖的package包/类
public void setTableName(String name) {
    table = new DatabaseTable(name);
}
 

开发者ID:jmrunge,
项目名称:osiris-platform,
代码行数:4,
代码来源:TableSequence.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)