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


Java FetchType类代码示例

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


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

示例1: generateEntityClass

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
/**
 * Generates entity classes for given tables.
 *
 * @param project project where the classes should be generated.
 * @param location source location.
 * @param packageName name of the package where the classes should be generated.
 * @param tableNames names of the tables.
 * @param dbconn connection to the DB with the tables.
 * @param unit persistence unit to add the generated classes into
 * @return entity class that corresponds to the specified table and names
 * of the entity classes for related tables (if <code>relatedTableNames</code>
 * parameter was non-<code>null</code>).
 */
private static String[] generateEntityClass(final Project project, SourceGroup location, String packageName, DatabaseConnection dbconn, List<String> tableNames, PersistenceUnit unit) {
    try {
        boolean regenTablesAttrs = "org.apache.derby.jdbc.EmbeddedDriver".equals(dbconn.getDriverClass()); // NOI18N
        EntitiesFromDBGenerator generator = new EntitiesFromDBGenerator(tableNames, true, true, regenTablesAttrs,
                FetchType.DEFAULT, CollectionType.LIST,
                packageName, location, dbconn, project, unit);
        // PENDING
        final Set<FileObject> entities = generator.generate(AggregateProgressFactory.createProgressContributor("PENDING"));

        String[] result = new String[entities.size()];
        int count = 0;
        for (FileObject fob : entities) {
            result[count++] = packageName + '.' + fob.getName();
        }
        return result;
    } catch (SQLException sex) {
        Logger.getLogger(J2EEUtils.class.getName()).log(Level.INFO, null, sex);
    } catch (IOException ioex) {
        Logger.getLogger(J2EEUtils.class.getName()).log(Level.INFO, null, ioex);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:J2EEUtils.java

示例2: generateBeans

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
void generateBeans(EntityClass[] entityClasses, boolean generateNamedQueries,
        boolean generateJAXBAnnotations,
        boolean generateValidationConstraints,
        boolean fullyQualifiedTableNames, boolean regenTablesAttrs,
        FetchType fetchType, CollectionType collectionType,
        ProgressContributor progressContributor, ProgressPanel panel, Project prj) throws IOException {
    
    generateBeans(entityClasses, generateNamedQueries, generateJAXBAnnotations, 
            generateValidationConstraints, fullyQualifiedTableNames, regenTablesAttrs, 
            false, false, fetchType, collectionType, progressContributor, panel, prj);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:JavaPersistenceGenerator.java

示例3: Generator

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public Generator(EntityClass[] entityClasses, boolean generateNamedQueries,
        boolean generateJAXBAnnotations,
        boolean generateValidationConstraints,
        boolean fullyQualifiedTableNames, boolean regenTablesAttrs,
        boolean useDefaults,
        boolean generateMappedSC,
        FetchType fetchType, CollectionType collectionType,
        ProgressContributor progressContributor, ProgressPanel progressPanel,
        PersistenceGenerator persistenceGen) {
    this.entityClasses = entityClasses;
    this.generateNamedQueries = generateNamedQueries;
    this.generateJAXBAnnotations = generateJAXBAnnotations;
    this.generateValidationConstraints = generateValidationConstraints;
    this.fullyQualifiedTableNames = fullyQualifiedTableNames;
    this.useDefaults = useDefaults;
    this.generateMappedSC = generateMappedSC;
    this.regenTablesAttrs = regenTablesAttrs;
    this.fetchType = fetchType;
    this.collectionType = collectionType;
    this.progressContributor = progressContributor;
    this.progressPanel = progressPanel;
    generatedFOs = new HashSet<FileObject>();
    generatedEntityFOs = new HashSet<FileObject>();
    this.persistenceGen = persistenceGen;
    replacedNames = new HashMap<String, String>();
    replacedTypeNames = new HashMap<String, String>();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:JavaPersistenceGenerator.java

示例4: initialize

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public void initialize(CollectionType collectionType, FetchType fetchType, boolean fullyQualifiedTblName, boolean regenSchemaAttrs, boolean useColumnNamesInRelationships) {
    
    switch(fetchType) {
        case EAGER:
            fetchComboBox.setSelectedIndex(1);
            break;
        case LAZY:
            fetchComboBox.setSelectedIndex(2);
            break;
        case DEFAULT:
        default:
            fetchComboBox.setSelectedIndex(0);
    }
    
    switch(collectionType) {
        case LIST:
            collectionTypeComboBox.setSelectedIndex(1);
            break;
        case SET:
            collectionTypeComboBox.setSelectedIndex(2);
            break;
        case COLLECTION:
        default:
            collectionTypeComboBox.setSelectedIndex(0);
    }
    
    tableNameCheckBox.setSelected(fullyQualifiedTblName);
    regenTablesCheckBox.setSelected(regenSchemaAttrs);
    relationshipColumnNamesCheckBox.setSelected(useColumnNamesInRelationships);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:MappingOptionsPanel.java

示例5: getFetchType

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public FetchType getFetchType() {
    int selected = fetchComboBox.getSelectedIndex();
    if(selected == 0 ) {
        return FetchType.DEFAULT;
    } else if(selected == 1 ) {
        return FetchType.EAGER;
    } else {
        return FetchType.LAZY;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:MappingOptionsPanel.java

示例6: readSettings

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public void readSettings(WizardDescriptor settings) {
    wizardDescriptor = settings;
    
    if (!componentInitialized) {
        componentInitialized = true;

        RelatedCMPHelper helper = RelatedCMPWizard.getHelper(wizardDescriptor);
        FetchType fetchType = helper.getFetchType();
        boolean fullTblName = helper.isFullyQualifiedTableNames();
        boolean regenSchema = helper.isRegenTablesAttrs();
        boolean useColumnNamesInRelationships = helper.isUseColumnNamesInRelationships();
        CollectionType clcType = helper.getCollectionType();
        getComponent().initialize(clcType, fetchType, fullTblName, regenSchema, useColumnNamesInRelationships);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:MappingOptionsPanel.java

示例7: testGenerateOneEntity

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public void testGenerateOneEntity() throws IOException{
    EntityClass user = getUserEntity();
    
    generator.generateBeans(new EntityClass[]{user}, true, false, false, false, false,
            FetchType.DEFAULT, CollectionType.COLLECTION, getProgressContributor(), null, null);
    assertEquals(1,generator.createdObjects().size());
    
    FileObject result = generator.createdObjects().iterator().next();
    assertFile(FileUtil.toFile(result), getGoldenFile("testGenEntity/" + result.getName() + ".pass"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:JPAGenTest.java

示例8: testGenerateTwoUnrelated

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public void testGenerateTwoUnrelated() throws IOException{
    
    EntityClass user = getUserEntity();
    
    EntityClass product = new EntityClass( null, null ,"PRODUCT", 
            getWorkDirFO(), packageName, "Product", UpdateType.NEW, false, null);
    product.usePkField(true);
    
    EntityMemberImpl description = new EntityMemberImpl();
    description.setMemberName("description");
    description.setColumnName("DESCRIPTION");
    description.setSupportsFinder(true);
    description.setNullable(false);
    description.setPrimaryKey(false);
    description.setMemberType("java.lang.String");
    description.setTableName("PRODUCT");
    
    EntityMember id = getId("PRODUCT");
    
    List<EntityMember> fields = new ArrayList<EntityMember>();
    fields.add(id);
    fields.add(description);
    
    product.setFields(fields);
    
    
    generator.generateBeans(new EntityClass[]{user, product}, true, false, false,
            false, false, FetchType.DEFAULT, CollectionType.COLLECTION,
            getProgressContributor(), null, null);
    Set<FileObject> result = generator.createdObjects();
    assertEquals(2, result.size());
  
    for(FileObject each : result){
        assertFile(FileUtil.toFile(each), getGoldenFile("testGenUnrelated/" + each.getName() + ".pass"));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:JPAGenTest.java

示例9: EntitiesFromDBGenerator

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
/**
 * Creates a new instance of EntitiesFromDBGenerator.
 *
 * @param tableNames the names of the tables for which entities are generated. Must not be null.
 * @param generateNamedQueries specifies whether named queries should be generated.
 * @param fullyQualifiedTableNames specifies whether fully qualified database table names should be used.
 *        Attribute catalog and schema are added to the Table annotation if true
 * @param regenTablesAttrs specified whether attributes used for regenerating tables from entity classes
 *        should be included. If true, unique containtraints are generated on @Table annotation and attributes
 *        nullable (if false), length (for String type), precision and scale(for decimal type) are added to
 *        the Column annotation
 * @param fetchType specifies the fetch type for the associations. Can be <code>FetchType.DEFAULT</code>,
 *        <code>FetchType.EAGER</code> or <code>FetchType.LAZY</code>. Default to <code>FetchType.DEFAULT</code>,
 *        meaning no fetch attribute is added to the relationship annotation
 * @param collectionType specifies the collection type for the OneToMany and ManyToMany fields.
 *        Can be <code>CollectionType.COLLECTION</code>, <code>CollectionType.LIST</code> or
 *        <code>CollectionType.SET</code>. Default to <code>CollectionType.COLLECTION</code>.
 * @param packageName the name of the package for the generated entities. Must not be null.
 * @param location the location. Must not be null.
 * @param connection the database connection for the specified tables. Must not be null.
 * @param project the project to which entities are generated.
 * @param persistenceUnit the persistenceUnit to which generated entities should be added
 * as managed classes. May be null, in which case it is up to the client to add
 * the generated entities to an appropriate persistence unit (if any).
 *
 */
public EntitiesFromDBGenerator(List<String> tableNames, boolean generateNamedQueries,
        boolean fullyQualifiedTableNames, boolean regenTablesAttrs,
        FetchType fetchType, CollectionType collectionType,
        String packageName, SourceGroup location, DatabaseConnection connection,
        Project project, PersistenceUnit persistenceUnit) {
    Parameters.notNull("project", project); //NOI18N
    Parameters.notNull("tableNames", tableNames); //NOI18N
    Parameters.notNull("packageName", packageName); //NOI18N
    Parameters.notNull("location", location); //NOI18N
    Parameters.notNull("connection", connection); //NOI18N
    
    this.tableNames = tableNames;
    this.generateNamedQueries = generateNamedQueries;
    this.fullyQualifiedTableNames = fullyQualifiedTableNames;
    this.regenTableAttrs = regenTablesAttrs;
    this.fetchType = fetchType;
    this.collectionType = collectionType;
    this.packageName = packageName;
    this.location = location;
    this.connection = connection;
    this.project = project;
    this.persistenceUnit = persistenceUnit;
    this.generator = new JavaPersistenceGenerator(persistenceUnit);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:EntitiesFromDBGenerator.java

示例10: getFetchType

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public FetchType getFetchType() {
    return fetchType;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:RelatedCMPHelper.java

示例11: setFetchType

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public void setFetchType(FetchType fetchType) {
    this.fetchType = fetchType;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:RelatedCMPHelper.java

示例12: getFetchType

import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public FetchType getFetchType() {
     return FetchType.DEFAULT;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:DbSchemaEjbGeneratorTest.java


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