org.hibernate.Criteria.setFlushMode()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.hibernate.Criteria.setFlushMode()方法的一些代码示例,展示了Criteria.setFlushMode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Criteria.setFlushMode()方法的具体详情如下:
包路径:org.hibernate.Criteria
类名称:Criteria
方法名:setFlushMode

Criteria.setFlushMode介绍

[英]Override the flush mode for this particular query.
[中]覆盖此特定查询的刷新模式。

代码示例

代码示例来源:origin: hibernate/hibernate-orm

private Criteria getCriteria(Session s) {
  Criteria crit = s.createCriteria( A.class, "anAlias" );
  crit.add( Restrictions.naturalId().set( "name", "name1" ) );
  crit.setFlushMode( FlushMode.COMMIT );
  crit.setCacheable( true );
  return crit;
}

代码示例来源:origin: TGAC/miso-lims

@Override
public Criteria setFlushMode(FlushMode flushMode) {
 backingCriteria.setFlushMode(flushMode);
 return this;
}

代码示例来源:origin: ezbz/projectx

@Override
public Criteria setFlushMode(final FlushMode flushMode) {
 return criteria.setFlushMode(flushMode);
}

代码示例来源:origin: com.pojosontheweb/woko-usermanagement-hibernate

@Override
@SuppressWarnings("unchecked")
public U getUserByUsername(String username) {
  Session s = hibernateStore.getSession();
  List l = s.createCriteria(getUserClass())
      .add(Restrictions.eq("username", username))
      .setFlushMode(FlushMode.MANUAL)
      .list();
  if (l.size()==0) {
    return null;
  }
  if (l.size()>1) {
    throw new IllegalStateException("more than 1 users with username==" + username);
  }
  return (U)l.get(0);
}

代码示例来源:origin: com.pojosontheweb/woko-usermanagement-hibernate

@Override
@SuppressWarnings("unchecked")
public U getUserByEmail(String email) {
  Session s = hibernateStore.getSession();
  List l = s.createCriteria(getUserClass())
      .add(Restrictions.eq("email", email))
      .setFlushMode(FlushMode.MANUAL)
      .list();
  if (l.size()==0) {
    return null;
  }
  if (l.size()>1) {
    throw new IllegalStateException("more than 1 users with email==" + email);
  }
  return (U)l.get(0);
}

代码示例来源:origin: at.chrl/chrl-orm

/**
 * crates a Stream with given {@link Criteria} crit
 * 
 * @param crit
 *            - given Criteria
 * @return new {@link Stream} with given ResultSet
 */
public <T> Stream<T> stream(Criteria crit) {
  if(TransactionStatus.NOT_ACTIVE.equals(session.getTransaction().getStatus()))
    session.beginTransaction();
  if (loggingEnabled)
    logQuery(false);
  
  return StreamSupport.<T> stream(Spliterators.spliteratorUnknownSize(
      new QueryIterator<T>(crit.setCacheMode(CacheMode.IGNORE)
          .setFlushMode(FlushMode.MANUAL), this, false),
      Spliterator.ORDERED | Spliterator.DISTINCT), false);
}

代码示例来源:origin: hibernate/hibernate-search

.setLockMode( LockMode.NONE )
.setCacheable( false )
.setFlushMode( FlushMode.MANUAL )
.setFetchSize( listIds.size() )
.setResultTransformer( CriteriaSpecification.DISTINCT_ROOT_ENTITY )

代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core

c.setFlushMode(convertFlushMode(argMap.get(DynamicFinder.ARGUMENT_FLUSH_MODE)));

代码示例来源:origin: org.grails/grails-hibernate

c.setFlushMode(converter.convertIfNecessary(argMap.get(ARGUMENT_FLUSH_MODE),FlushMode.class));

代码示例来源:origin: hibernate/hibernate-search

.setLockMode( LockMode.NONE )
.setCacheable( false )
.setFlushMode( FlushMode.MANUAL )
.setFetchSize( listIds.size() )
.setResultTransformer( CriteriaSpecification.DISTINCT_ROOT_ENTITY )

代码示例来源:origin: hibernate/hibernate-search

.setCacheable( false )
.setLockMode( LockMode.NONE )
.setFlushMode( FlushMode.MANUAL )
.setCacheMode( cacheMode )
.setFetchSize( entityFetchSize )

相关文章