本文整理汇总了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;
}
示例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);
}
示例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>();
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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"));
}
示例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"));
}
}
示例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);
}
示例10: getFetchType
import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public FetchType getFetchType() {
return fetchType;
}
示例11: setFetchType
import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public void setFetchType(FetchType fetchType) {
this.fetchType = fetchType;
}
示例12: getFetchType
import org.netbeans.modules.j2ee.persistence.entitygenerator.EntityRelation.FetchType; //导入依赖的package包/类
public FetchType getFetchType() {
return FetchType.DEFAULT;
}