本文整理汇总了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));
}
示例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--------*/
}
示例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());
}
}
}
示例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;
}
示例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;
}