下面列出了org.hibernate.persister.collection.CollectionPersister#getFactory ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Constructs a BasicCollectionLoadQueryDetails object from the given inputs.
*
* @param collectionPersister The collection persister.
* @param loadPlan The load plan.
* @param buildingParameters And influencers that would affect the generated SQL (mostly we are concerned with those
* that add additional joins here)
*
* @return The EntityLoadQueryDetails
*/
public LoadQueryDetails makeCollectionLoadQueryDetails(
CollectionPersister collectionPersister,
LoadPlan loadPlan,
QueryBuildingParameters buildingParameters) {
final CollectionReturn rootReturn = RootHelper.INSTANCE.extractRootReturn( loadPlan, CollectionReturn.class );
final AliasResolutionContextImpl aliasResolutionContext = new AliasResolutionContextImpl(
collectionPersister.getFactory()
);
return collectionPersister.isOneToMany() ?
new OneToManyLoadQueryDetails(
loadPlan,
aliasResolutionContext,
rootReturn,
buildingParameters,
collectionPersister.getFactory()
) :
new BasicCollectionLoadQueryDetails(
loadPlan,
aliasResolutionContext,
rootReturn,
buildingParameters,
collectionPersister.getFactory()
);
}
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
throws HibernateException, SQLException {
Object object = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
final Type elementType = persister.getElementType();
final SessionFactoryImplementor factory = persister.getFactory();
String indexNode = getIndexAttributeName(persister);
Element elem = element.addElement( persister.getElementNodeName() );
elementType.setToXMLNode( elem, object, factory );
final Type indexType = persister.getIndexType();
final Object indexValue = persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
final String index = ( (NullableType) indexType ).toXMLString( indexValue, factory );
setIndex(elem, indexNode, index);
return object;
}
public CollectionKey(CollectionPersister persister, Serializable key) {
this(
persister.getRole(),
key,
persister.getKeyType(),
persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode(),
persister.getFactory()
);
}
public CollectionKey(CollectionPersister persister, Serializable key, EntityMode em) {
this( persister.getRole(), key, persister.getKeyType(), em, persister.getFactory() );
}
public CollectionKey(CollectionPersister persister, Serializable key, EntityMode em) {
this( persister.getRole(), key, persister.getKeyType(), em, persister.getFactory() );
}