本文整理汇总了Java中javax.jdo.metadata.FieldMetadata.setTable方法的典型用法代码示例。如果您正苦于以下问题:Java FieldMetadata.setTable方法的具体用法?Java FieldMetadata.setTable怎么用?Java FieldMetadata.setTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jdo.metadata.FieldMetadata
的用法示例。
在下文中一共展示了FieldMetadata.setTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processHistoryTrashRelationship
import javax.jdo.metadata.FieldMetadata; //导入方法依赖的package包/类
private void processHistoryTrashRelationship(ClassMetadata cmd, FieldMetadata fmd, RelationshipHolder holder) {
if (holder.isOneToOne() || holder.isManyToOne()) {
fmd.setColumn(holder.getFieldName() + ID_SUFFIX);
} else {
fmd.setTable(cmd.getTable() + '_' + holder.getFieldName());
CollectionMetadata collMd = fmd.newCollectionMetadata();
collMd.setElementType(Long.class.getName());
JoinMetadata joinMd = fmd.newJoinMetadata();
ColumnMetadata joinColumnMd = joinMd.newColumnMetadata();
joinColumnMd.setName(cmd.getName() + ID_SUFFIX);
ElementMetadata elementMd = fmd.newElementMetadata();
elementMd.setColumn(holder.getFieldName() + ID_SUFFIX);
}
}
示例2: setComboboxMetadata
import javax.jdo.metadata.FieldMetadata; //导入方法依赖的package包/类
private FieldMetadata setComboboxMetadata(ClassMetadata cmd, EntityDto entity, FieldDto field,
Class<?> definition, EntityType entityType) {
ComboboxHolder holder = new ComboboxHolder(entity, field);
String fieldName = getNameForMetadata(field);
FieldMetadata fmd = cmd.newFieldMetadata(fieldName);
if (holder.isCollection()) {
addDefaultFetchGroupMetadata(fmd, definition);
fmd.setTable(ClassTableName.getTableName(cmd.getTable(), fieldName));
JoinMetadata jm = fmd.newJoinMetadata();
ForeignKeyMetadata fkmd = getOrCreateFkMetadata(jm);
fkmd.setName(KeyNames.cbForeignKeyName(entity.getName(), entity.getId(), fieldName, entityType));
jm.setDeleteAction(ForeignKeyAction.CASCADE);
jm.newColumnMetadata().setName(fieldName + "_OID");
}
return fmd;
}
示例3: setMapMetadata
import javax.jdo.metadata.FieldMetadata; //导入方法依赖的package包/类
private FieldMetadata setMapMetadata(ClassMetadata cmd, EntityDto entity, FieldDto field,
Class<?> definition, EntityType entityType) {
FieldMetadata fmd = cmd.newFieldMetadata(getNameForMetadata(field));
MetadataDto keyMetadata = field.getMetadata(MAP_KEY_TYPE);
MetadataDto valueMetadata = field.getMetadata(MAP_VALUE_TYPE);
boolean serialized = shouldSerializeMap(keyMetadata, valueMetadata);
// Depending on the types of key and value of the map we either serialize the map or create a separate table for it
fmd.setSerialized(serialized);
addDefaultFetchGroupMetadata(fmd, definition);
MapMetadata mmd = fmd.newMapMetadata();
if (serialized) {
mmd.setSerializedKey(true);
mmd.setSerializedValue(true);
} else {
mmd.setKeyType(keyMetadata.getValue());
mmd.setValueType(valueMetadata.getValue());
fmd.setTable(ClassTableName.getTableName(cmd.getTable(), getNameForMetadata(field)));
JoinMetadata jmd = fmd.newJoinMetadata();
ForeignKeyMetadata fkmd = getOrCreateFkMetadata(jmd);
fkmd.setDeleteAction(ForeignKeyAction.CASCADE);
fkmd.setName(KeyNames.mapForeignKeyName(entity.getName(), entity.getId(), field.getBasic().getName(),
entityType));
}
return fmd;
}
示例4: setTableNameMetadata
import javax.jdo.metadata.FieldMetadata; //导入方法依赖的package包/类
private void setTableNameMetadata(FieldMetadata fmd, Persistent persistent, EntityDto entity, FieldDto field,
RelationshipHolder holder, EntityType entityType) {
if (persistent != null && StringUtils.isNotEmpty(persistent.table()) && entityType != EntityType.STANDARD) {
fmd.setTable(entityType.getTableName(persistent.table()));
} else if (persistent == null || StringUtils.isEmpty(persistent.table())) {
fmd.setTable(getJoinTableName(entity.getModule(), entity.getNamespace(), field.getBasic().getName(),
holder.getRelatedField()));
}
}