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

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

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

Query.setCacheRegion介绍

暂无

代码示例

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

  1. protected void setQueryProperties(Query query) {
  2. if ( maxResults != null ) {
  3. query.setMaxResults( maxResults );
  4. }
  5. if ( firstResult != null ) {
  6. query.setFirstResult( firstResult );
  7. }
  8. if ( cacheable != null ) {
  9. query.setCacheable( cacheable );
  10. }
  11. if ( cacheRegion != null ) {
  12. query.setCacheRegion( cacheRegion );
  13. }
  14. if ( comment != null ) {
  15. query.setComment( comment );
  16. }
  17. if ( flushMode != null ) {
  18. query.setFlushMode( flushMode );
  19. }
  20. if ( cacheMode != null ) {
  21. query.setCacheMode( cacheMode );
  22. }
  23. if ( timeout != null ) {
  24. query.setTimeout( timeout );
  25. }
  26. if ( lockOptions != null && lockOptions.getLockMode() != LockMode.NONE ) {
  27. query.setLockMode( REFERENCED_ENTITY_ALIAS, lockOptions.getLockMode() );
  28. }
  29. }

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

  1. .setParameter( "id", 0L)
  2. .setCacheable(true)
  3. .setCacheRegion( "query.cache.person" )
  4. .list();
  5. .setParameter( "id", 0L)
  6. .setCacheable(true)
  7. .setCacheRegion( "query.cache.person" )
  8. .setCacheMode( CacheMode.REFRESH )
  9. .list();

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

  1. protected void initQueryFromNamedDefinition(Query query, NamedQueryDefinition nqd) {
  2. // todo : cacheable and readonly should be Boolean rather than boolean...
  3. query.setCacheable( nqd.isCacheable() );
  4. query.setCacheRegion( nqd.getCacheRegion() );
  5. query.setReadOnly( nqd.isReadOnly() );
  6. if ( nqd.getTimeout() != null ) {
  7. query.setTimeout( nqd.getTimeout() );
  8. }
  9. if ( nqd.getFetchSize() != null ) {
  10. query.setFetchSize( nqd.getFetchSize() );
  11. }
  12. if ( nqd.getCacheMode() != null ) {
  13. query.setCacheMode( nqd.getCacheMode() );
  14. }
  15. if ( nqd.getComment() != null ) {
  16. query.setComment( nqd.getComment() );
  17. }
  18. if ( nqd.getFirstResult() != null ) {
  19. query.setFirstResult( nqd.getFirstResult() );
  20. }
  21. if ( nqd.getMaxResults() != null ) {
  22. query.setMaxResults( nqd.getMaxResults() );
  23. }
  24. if ( nqd.getFlushMode() != null ) {
  25. query.setHibernateFlushMode( nqd.getFlushMode() );
  26. }
  27. }

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

  1. session -> session.createQuery( queryString ).setCacheable( true ).setCacheRegion( queryCacheRegionName ).list()
  2. );

代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter

  1. @Override
  2. public Query setCacheRegion(final String cacheRegion) {
  3. if (queryV2ForCompare != null) {
  4. queryV2ForCompare.setCacheRegion(cacheRegion);
  5. }
  6. query.setCacheRegion(cacheRegion);
  7. return this;
  8. }

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

  1. query.setCacheRegion( cacheRegion );

相关文章