Java Code Examples for org.hibernate.Query.setComment()

The following are Jave code examples for showing how to use setComment() of the org.hibernate.Query class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: lams   File: AbstractSessionImpl.java   Source Code and License Vote up 6 votes
@Override
public Query createQuery(NamedQueryDefinition namedQueryDefinition) {
	String queryString = namedQueryDefinition.getQueryString();
	final Query query = new QueryImpl(
			queryString,
			namedQueryDefinition.getFlushMode(),
			this,
			getHQLQueryPlan( queryString, false ).getParameterMetadata()
	);
	query.setComment( "named HQL query " + namedQueryDefinition.getName() );
	if ( namedQueryDefinition.getLockOptions() != null ) {
		query.setLockOptions( namedQueryDefinition.getLockOptions() );
	}

	return query;
}
 
Example 2
Project: lams   File: AbstractSessionImpl.java   Source Code and License Vote up 6 votes
@Override
public Query getNamedSQLQuery(String queryName) throws MappingException {
	errorIfClosed();
	NamedSQLQueryDefinition nsqlqd = factory.getNamedSQLQuery( queryName );
	if ( nsqlqd==null ) {
		throw new MappingException( "Named SQL query not known: " + queryName );
	}
	Query query = new SQLQueryImpl(
			nsqlqd,
	        this,
	        factory.getQueryPlanCache().getSQLParameterMetadata( nsqlqd.getQueryString() )
	);
	query.setComment( "named native SQL query " + queryName );
	initQuery( query, nsqlqd );
	return query;
}
 
Example 3
Project: lams   File: AbstractSessionImpl.java   Source Code and License Vote up 5 votes
private void initQuery(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.setFlushMode( nqd.getFlushMode() );
	}
}