protected QueryImplementor createQuery(NamedQueryDefinition queryDefinition) { String queryString = queryDefinition.getQueryString(); final QueryImpl query = new QueryImpl( this, getQueryPlan( queryString, false ).getParameterMetadata(), queryString ); query.setHibernateFlushMode( queryDefinition.getFlushMode() ); query.setComment( queryDefinition.getComment() != null ? queryDefinition.getComment() : queryDefinition.getName() ); if ( queryDefinition.getLockOptions() != null ) { query.setLockOptions( queryDefinition.getLockOptions() ); } initQueryFromNamedDefinition( query, queryDefinition ); // applyQuerySettingsAndHints( query ); return query; }
public NamedQueryDefinition makeCopy(String name) { return new NamedQueryDefinition( name, getQuery(), isCacheable(), getCacheRegion(), getTimeout(), getLockOptions(), getFetchSize(), getFlushMode(), getCacheMode(), isReadOnly(), getComment(), getParameterTypes(), getFirstResult(), getMaxResults() ); } }
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() ); } }
@SuppressWarnings("unchecked") protected static XQuery createQuery( XSessionImplementor sessionProxy, NamedQueryDefinition namedQueryDefinition) throws HibernateException { String queryString = namedQueryDefinition.getQueryString(); XQueryPlan xQueryPlan = (XQueryPlan) sessionProxy .getFactory() .getQueryPlanCache() .getHQLQueryPlan(queryString, false, sessionProxy.getRawSessionImpl().getEnabledFilters() ); XQuery query = new XQueryImpl( queryString, namedQueryDefinition.getFlushMode(), sessionProxy, xQueryPlan.getParameterMetadata() ); query.setComment( "named HQL query " + namedQueryDefinition.getName() ); if ( namedQueryDefinition.getLockOptions() != null ) { query.setLockOptions( namedQueryDefinition.getLockOptions() ); } return query; }
query = new QueryImpl( queryString, nqd.getFlushMode(), this, getHQLQueryPlan( queryString, false ).getParameterMetadata()
query = new QueryImpl( queryString, nqd.getFlushMode(), this, getHQLQueryPlan( queryString, false ).getParameterMetadata()
XQuery query = new XQueryImpl( queryString, nqd.getFlushMode(), sessionProxy, xQueryPlan.getParameterMetadata()