org.hibernate.query.Query.setHibernateFlushMode()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(177)

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

Query.setHibernateFlushMode介绍

暂无

代码示例

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

/**
 * (Re)set the current FlushMode in effect for this query.
 *
 * @param flushMode The new FlushMode to use.
 *
 * @return {@code this}, for method chaining
 *
 * @see #getHibernateFlushMode()
 *
 * @deprecated (since 5.2) use {@link #setHibernateFlushMode} instead
 */
@Override
@Deprecated
default Query<R> setFlushMode(FlushMode flushMode) {
  setHibernateFlushMode( flushMode );
  return this;
}

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

protected void initQueryFromNamedDefinition(Query query, NamedQueryDefinition nqd) {
  // todo : cacheable and readonly should be Boolean rather than boolean...
  query.setCacheable( nqd.isCacheable() );
  query.setCacheRegion( nqd.getCacheRegion() );
  query.setReadOnly( nqd.isReadOnly() );
  if ( nqd.getTimeout() != null ) {
    query.setTimeout( nqd.getTimeout() );
  }
  if ( nqd.getFetchSize() != null ) {
    query.setFetchSize( nqd.getFetchSize() );
  }
  if ( nqd.getCacheMode() != null ) {
    query.setCacheMode( nqd.getCacheMode() );
  }
  if ( nqd.getComment() != null ) {
    query.setComment( nqd.getComment() );
  }
  if ( nqd.getFirstResult() != null ) {
    query.setFirstResult( nqd.getFirstResult() );
  }
  if ( nqd.getMaxResults() != null ) {
    query.setMaxResults( nqd.getMaxResults() );
  }
  if ( nqd.getFlushMode() != null ) {
    query.setHibernateFlushMode( nqd.getFlushMode() );
  }
}

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

.setCacheable( false )
.setLockMode( LockModeType.NONE )
.setHibernateFlushMode( FlushMode.MANUAL )
.setCacheMode( cacheMode )
.setFetchSize( entityFetchSize )

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

query.setHibernateFlushMode( flushMode );

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

@Test
@TestForIssue(jiraKey = "OGM-424")
@SkipByGridDialect(INFINISPAN_REMOTE)
public void testSetFlushModeIsApplied() throws Exception {
  Query<Hypothesis> query = session.createQuery( "from Hypothesis h where h.position = 31" );
  assertQuery( session, 0, query );
  Hypothesis hypothesis = new Hypothesis();
  hypothesis.setId( "31" );
  hypothesis.setDescription( "In the morning it's darker than outside" );
  hypothesis.setPosition( 31 );
  session.persist( hypothesis );
  query.setHibernateFlushMode( FlushMode.MANUAL );
  assertQuery( session, query, 0, "No auto-flush should be performed prior to query execution" );
  session.flush();
  if ( TestHelper.getCurrentDialectType().supportsQueries() ) {
    assertQuery( session, query, 1, "Flushed result should be returned by query" );
  }
  else {
    assertQuery( session, query, 0, "Flushed result not be returned by query executed via Hibernate Search" );
  }
  session.delete( hypothesis );
}

相关文章