本文整理汇总了Java中org.hibernate.mapping.Collection.getElement方法的典型用法代码示例。如果您正苦于以下问题:Java Collection.getElement方法的具体用法?Java Collection.getElement怎么用?Java Collection.getElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.mapping.Collection
的用法示例。
在下文中一共展示了Collection.getElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindUnidirectionalOneToMany
import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
/**
* Binds a unidirectional one-to-many creating a psuedo back reference property in the process.
*
* @param property
* @param mappings
* @param collection
*/
protected void bindUnidirectionalOneToMany(org.grails.datastore.mapping.model.types.OneToMany property, InFlightMetadataCollector mappings, Collection collection) {
Value v = collection.getElement();
v.createForeignKey();
String entityName;
if (v instanceof ManyToOne) {
ManyToOne manyToOne = (ManyToOne) v;
entityName = manyToOne.getReferencedEntityName();
} else {
entityName = ((OneToMany) v).getReferencedEntityName();
}
collection.setInverse(false);
PersistentClass referenced = mappings.getEntityBinding(entityName);
Backref prop = new Backref();
PersistentEntity owner = property.getOwner();
prop.setEntityName(owner.getName());
prop.setName(UNDERSCORE + addUnderscore(owner.getJavaClass().getSimpleName(), property.getName()) + "Backref");
prop.setUpdateable(false);
prop.setInsertable(true);
prop.setCollectionRole(collection.getRole());
prop.setValue(collection.getKey());
prop.setOptional(true);
referenced.addProperty(prop);
}
示例2: checkFilterConditions
import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
private static void checkFilterConditions(Collection collValue) {
//for now it can't happen, but sometime soon...
if ( ( collValue.getFilters().size() != 0 || StringHelper.isNotEmpty( collValue.getWhere() ) ) &&
collValue.getFetchMode() == FetchMode.JOIN &&
!( collValue.getElement() instanceof SimpleValue ) && //SimpleValue (CollectionOfElements) are always SELECT but it does not matter
collValue.getElement().getFetchMode() != FetchMode.JOIN ) {
throw new MappingException(
"@ManyToMany or @CollectionOfElements defining filter or where without join fetching "
+ "not valid within collection using join fetching[" + collValue.getRole() + "]"
);
}
}
示例3: afterConfigurationBuilt
import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
super.afterConfigurationBuilt( mappings, dialect );
Collection children = mappings.getCollection( Parent.class.getName() + ".children" );
Component childComponents = ( Component ) children.getElement();
Formula f = ( Formula ) childComponents.getProperty( "bioLength" ).getValue().getColumnIterator().next();
SQLFunction lengthFunction = ( SQLFunction ) dialect.getFunctions().get( "length" );
if ( lengthFunction != null ) {
ArrayList args = new ArrayList();
args.add( "bio" );
f.setFormula( lengthFunction.render( args, null ) );
}
}
示例4: CollectionPersisterImpl
import org.hibernate.mapping.Collection; //导入方法依赖的package包/类
public CollectionPersisterImpl(
Collection collectionBinding,
ManagedTypeImplementor source,
String localName,
CollectionRegionAccessStrategy collectionCaching,
PersisterCreationContext creationContext) {
super( source, localName, PropertyAccess.DUMMY );
this.source = source;
this.localName = localName;
this.role = source.getNavigableName() + '.' + this.localName;
this.collectionClassification = PersisterHelper.interpretCollectionClassification( collectionBinding );
this.foreignKeyDescriptor = new CollectionKey( this );
this.typeConfiguration = creationContext.getTypeConfiguration();
this.collectionType = new CollectionTypeImpl(
role,
resolveCollectionJtd( creationContext, collectionClassification ),
null,
null
);
if ( collectionBinding instanceof IndexedCollection ) {
final Value indexValueMapping = ( (IndexedCollection) collectionBinding ).getIndex();
if ( indexValueMapping instanceof SimpleValue ) {
final SimpleValue simpleIndexValueMapping = (SimpleValue) indexValueMapping;
// indexAttributeConverter = simpleIndexValueMapping.getAttributeConverterDescriptor().getAttributeConverter();
}
}
final Value elementValueMapping = collectionBinding.getElement();
if ( elementValueMapping instanceof SimpleValue ) {
final SimpleValue simpleElementValueMapping = (SimpleValue) elementValueMapping;
// elementAttributeConverter = simpleElementValueMapping.getAttributeConverterDescriptor().getAttributeConverter();
}
}