• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AbstractPersistentCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClusterGroup类代码示例发布时间:2022-05-23
下一篇:
Java ICProject类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap