本文整理汇总了Java中org.hibernate.collection.internal.AbstractPersistentCollection类的典型用法代码示例。如果您正苦于以下问题:Java AbstractPersistentCollection类的具体用法?Java AbstractPersistentCollection怎么用?Java AbstractPersistentCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractPersistentCollection类属于org.hibernate.collection.internal包,在下文中一共展示了AbstractPersistentCollection类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldMap
import org.hibernate.collection.internal.AbstractPersistentCollection; //导入依赖的package包/类
@Override
public <S, D> boolean shouldMap(Type<S> type, String s, S s1, Type<D> type1, String s2, D d,
MappingContext mappingContext) {
if (type != null && s1 != null) {
if (type.isCollection()) {
if (s1 instanceof AbstractPersistentCollection) {
return false;
}
if (((PersistentSet) s1).wasInitialized()) {
return false;
}
}
}
return true;
}
开发者ID:empt-ak,项目名称:meditor,代码行数:18,代码来源:OrikaHibernateFilter.java
示例2: unsetCollectionHibernateSession
import org.hibernate.collection.internal.AbstractPersistentCollection; //导入依赖的package包/类
/**
* Whenever the entity has dirty persistent collection, make them clean to
* workaround a "bug" with hibernate since hibernate cannot re-attach a
* "dirty" detached collection.
*
* @param collection the collection
* @param targetSession the session that is targeted to after the dirty states have been
* reset or null if none.
*/
public static void unsetCollectionHibernateSession(PersistentCollection collection, Session targetSession) {
// Whenever the entity has dirty persistent collection, make them
// clean to workaround a "bug" with hibernate since hibernate cannot
// re-attach a "dirty" detached collection.
if (collection != null) {
if (Hibernate.isInitialized(collection)) {
collection.clearDirty();
}
if (collection instanceof AbstractPersistentCollection
&& ((AbstractPersistentCollection) collection).getSession() != null
&& targetSession != ((AbstractPersistentCollection) collection).getSession()) {
// The following is to avoid to avoid Hibernate exceptions due to
// re-associating a collection that is already associated with the
// session.
collection.unsetSession(((AbstractPersistentCollection) collection).getSession());
}
}
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:28,代码来源:HibernateHelper.java
示例3: getSerializer
import org.hibernate.collection.internal.AbstractPersistentCollection; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public Serializer getSerializer(Class cl) throws HessianProtocolException {
if (PersistentMap.class.isAssignableFrom(cl)) {
return mapSerializer;
} else if (AbstractPersistentCollection.class.isAssignableFrom(cl)) {
return listSerializer;
} else if (cl.getSimpleName().contains("_$$_javassist_")) {
return hibernateBeanSerializer;
}
return super.getSerializer(cl);
}
开发者ID:mmdsyl,项目名称:BLOG-Microservice,代码行数:12,代码来源:HibernateSerializerFactory.java
示例4: postInitialize
import org.hibernate.collection.internal.AbstractPersistentCollection; //导入依赖的package包/类
public void postInitialize(PersistentCollection collection) throws HibernateException {
snapshot = getLoadedPersister().isMutable() ?
collection.getSnapshot( getLoadedPersister() ) :
null;
collection.setSnapshot(loadedKey, role, snapshot);
if (getLoadedPersister().getBatchSize() > 1) {
((AbstractPersistentCollection) collection).getSession().getPersistenceContext().getBatchFetchQueue().removeBatchLoadableCollection(this);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:CollectionEntry.java
示例5: getRelation
import org.hibernate.collection.internal.AbstractPersistentCollection; //导入依赖的package包/类
@Override
public Object getRelation(
DataStoreTransaction relationTx,
Object entity,
String relationName,
Optional<FilterExpression> filterExpression,
Optional<Sorting> sorting,
Optional<Pagination> pagination,
RequestScope scope) {
EntityDictionary dictionary = scope.getDictionary();
Object val = com.yahoo.elide.core.PersistentResource.getValue(entity, relationName, scope);
if (val instanceof Collection) {
Collection filteredVal = (Collection) val;
if (filteredVal instanceof AbstractPersistentCollection) {
Class<?> relationClass = dictionary.getParameterizedType(entity, relationName);
RelationshipImpl relationship = new RelationshipImpl(
entity.getClass(),
relationClass,
relationName,
entity,
filteredVal);
pagination.ifPresent(p -> {
if (p.isGenerateTotals()) {
p.setPageTotals(getTotalRecords(relationship, filterExpression, dictionary));
}
});
final QueryWrapper query = (QueryWrapper)
new SubCollectionFetchQueryBuilder(relationship, dictionary, sessionWrapper)
.withPossibleFilterExpression(filterExpression)
.withPossibleSorting(sorting)
.withPossiblePagination(pagination)
.build();
if (query != null) {
return query.getQuery().list();
}
}
}
return val;
}
开发者ID:yahoo,项目名称:elide,代码行数:45,代码来源:HibernateTransaction.java
注:本文中的org.hibernate.collection.internal.AbstractPersistentCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论