当前位置: 首页>>代码示例>>Java>>正文


Java Table类代码示例

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


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

示例1: initialize

import org.netbeans.modules.j2ee.persistence.api.metadata.orm.Table; //导入依赖的package包/类
@Override
protected void initialize() throws IOException {
    org.netbeans.jpa.modeler.spec.Table tableSpec = new org.netbeans.jpa.modeler.spec.Table();
    tableSpec.setName(entityClass.getTableName());
    if (fullyQualifiedTableNames) {
        tableSpec.setSchema(entityClass.getSchemaName());
        tableSpec.setCatalog(entityClass.getCatalogName());
    }
    // UniqueConstraint annotations for the table
    if (entityClass.getUniqueConstraints() != null && !entityClass.getUniqueConstraints().isEmpty()) {
        for (List<String> constraintCols : entityClass.getUniqueConstraints()) {
            org.netbeans.jpa.modeler.spec.UniqueConstraint uniqueConstraint = new org.netbeans.jpa.modeler.spec.UniqueConstraint();
            for (String colName : constraintCols) {
                uniqueConstraint.getColumnName().add(colName);
            }
            tableSpec.getUniqueConstraint().add(uniqueConstraint);
        }
    }
    this.getEntityMappings().findEntity(entityClassName).ifPresent(e -> e.setTable(tableSpec));
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:21,代码来源:JavaPersistenceModelGenerator.java

示例2: initialize

import org.netbeans.modules.j2ee.persistence.api.metadata.orm.Table; //导入依赖的package包/类
@Override
protected void initialize() throws IOException {
    /*-------JPA Modeler Start-------*/
    org.netbeans.jpa.modeler.spec.Table tableSpec = new org.netbeans.jpa.modeler.spec.Table();
    tableSpec.setName(entityClass.getTableName());
    if (fullyQualifiedTableNames) {
        tableSpec.setSchema(entityClass.getSchemaName());
        tableSpec.setCatalog(entityClass.getCatalogName());
    }
    // UniqueConstraint annotations for the table
    if (entityClass.getUniqueConstraints() != null && !entityClass.getUniqueConstraints().isEmpty()) {
        for (List<String> constraintCols : entityClass.getUniqueConstraints()) {
            org.netbeans.jpa.modeler.spec.UniqueConstraint uniqueConstraint = new org.netbeans.jpa.modeler.spec.UniqueConstraint();
            for (String colName : constraintCols) {
                uniqueConstraint.getColumnName().add(colName);
            }
            tableSpec.getUniqueConstraint().add(uniqueConstraint);
        }
    }
    this.getEntityMappings().findEntity(entityClassName).setTable(tableSpec);
    /*--------JPA Modeler End--------*/
}
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:23,代码来源:JavaPersistenceModelGenerator.java

示例3: processEntities

import org.netbeans.modules.j2ee.persistence.api.metadata.orm.Table; //导入依赖的package包/类
private void processEntities(Set<Entity> entityClasses) {
    for (Entity entity : entityClasses) {
        Table entityTable = entity.getTable();
        if (entityTable != null) {
            entityName2TableName.put(entityTable.getName(), entity.getClass2());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:JavaPersistenceGenerator.java

示例4: completePrimaryKeyJoinColumn

import org.netbeans.modules.j2ee.persistence.api.metadata.orm.Table; //导入依赖的package包/类
private List completePrimaryKeyJoinColumn(JPACodeCompletionProvider.Context ctx, CCParser.CC nn, CCParser.NNAttr nnattr, List<JPACompletionItem> results) throws SQLException {
    String completedMember = nnattr.getName();
    
    if ("name".equals(completedMember)) { // NOI18N
        //XXX should I take into account the @SecondaryTable here???
        Entity entity = PersistenceUtils.getEntity(((TypeElement) ctx.getJavaClass()).getQualifiedName().toString(), ctx.getEntityMappings());
        if(entity != null) {
            org.netbeans.modules.j2ee.persistence.api.metadata.orm.Table table = entity.getTable();
            if(table != null) {
                String tableName = table.getName();
                if(tableName != null) {
                    String catalogName = getThisOrDefaultCatalog(table.getCatalog());
                    String schemaName = getThisOrDefaultSchema(table.getSchema());
                    //if(DEBUG) System.out.println("Columns for " + catalogName + "." + schemaName + "." + tableName);
                    TableElement tableElement = DBMetaDataUtils.getTable(provider, catalogName, schemaName, tableName);
                    if(tableElement != null) {
                        ColumnElement[] columnElements = tableElement.getColumns();
                        for (int i = 0; i < columnElements.length; i++) {
                            results.add(new JPACompletionItem.ColumnElementItem(columnElements[i].getName().getName(), tableName, true, -1));
                        }
                    }
                }
            }
        }
    }
    
    return results;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:DBCompletionContextResolver.java

示例5: getPrimaryTableName

import org.netbeans.modules.j2ee.persistence.api.metadata.orm.Table; //导入依赖的package包/类
/**
 * @return name of the primary table that will be mapped to given entity class
 */
public static String getPrimaryTableName(Entity entity){
    Table table = entity.getTable();
    return table!=null ? table.getName(): null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:JPAHelper.java


注:本文中的org.netbeans.modules.j2ee.persistence.api.metadata.orm.Table类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。