本文整理汇总了Java中org.hibernate.annotations.Columns类的典型用法代码示例。如果您正苦于以下问题:Java Columns类的具体用法?Java Columns怎么用?Java Columns使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Columns类属于org.hibernate.annotations包,在下文中一共展示了Columns类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildColumns
import org.hibernate.annotations.Columns; //导入依赖的package包/类
private Columns buildColumns(Element element) {
List<Element> subelements = element.elements( "column" );
List<Column> columns = new ArrayList<Column>( subelements.size() );
for ( Element subelement : subelements ) {
columns.add( getColumn( subelement, false, element ) );
}
if ( columns.size() > 0 ) {
AnnotationDescriptor columnsDescr = new AnnotationDescriptor( Columns.class );
columnsDescr.setValue( "columns", columns.toArray( new Column[columns.size()] ) );
return AnnotationFactory.create( columnsDescr );
}
else {
return null;
}
}
示例2: extractMetadata
import org.hibernate.annotations.Columns; //导入依赖的package包/类
public ColumnsBuilder extractMetadata() {
columns = null;
joinColumns = buildExplicitJoinColumns(property, inferredData);
if ( property.isAnnotationPresent( Column.class ) || property.isAnnotationPresent( Formula.class ) ) {
Column ann = property.getAnnotation( Column.class );
Formula formulaAnn = property.getAnnotation( Formula.class );
columns = Ejb3Column.buildColumnFromAnnotation(
new Column[] { ann }, formulaAnn, nullability, propertyHolder, inferredData,
entityBinder.getSecondaryTables(), mappings
);
}
else if ( property.isAnnotationPresent( Columns.class ) ) {
Columns anns = property.getAnnotation( Columns.class );
columns = Ejb3Column.buildColumnFromAnnotation(
anns.columns(), null,
nullability, propertyHolder, inferredData, entityBinder.getSecondaryTables(),
mappings
);
}
//set default values if needed
if ( joinColumns == null &&
( property.isAnnotationPresent( ManyToOne.class )
|| property.isAnnotationPresent( OneToOne.class ) )
) {
joinColumns = buildDefaultJoinColumnsForXToOne(property, inferredData);
}
else if ( joinColumns == null &&
( property.isAnnotationPresent( OneToMany.class )
|| property.isAnnotationPresent( ElementCollection.class )
) ) {
OneToMany oneToMany = property.getAnnotation( OneToMany.class );
String mappedBy = oneToMany != null ?
oneToMany.mappedBy() :
"";
joinColumns = Ejb3JoinColumn.buildJoinColumns(
null,
mappedBy, entityBinder.getSecondaryTables(),
propertyHolder, inferredData.getPropertyName(), mappings
);
}
else if ( joinColumns == null && property.isAnnotationPresent( org.hibernate.annotations.Any.class ) ) {
throw new AnnotationException( "@Any requires an explicit @JoinColumn(s): "
+ BinderHelper.getPath( propertyHolder, inferredData ) );
}
if ( columns == null && !property.isAnnotationPresent( ManyToMany.class ) ) {
//useful for collection of embedded elements
columns = Ejb3Column.buildColumnFromAnnotation(
null, null,
nullability, propertyHolder, inferredData, entityBinder.getSecondaryTables(), mappings
);
}
if ( nullability == Nullability.FORCED_NOT_NULL ) {
//force columns to not null
for (Ejb3Column col : columns ) {
col.forceNotNull();
}
}
return this;
}
示例3: annotationType
import org.hibernate.annotations.Columns; //导入依赖的package包/类
public Class<? extends Annotation> annotationType() {
return Columns.class;
}