@Override public void betweenFunctionArguments() { if ( startedType ) { throw new QueryException( "CAST function should only have 2 arguments" ); } startedType = true; }
public static void panic() { //overriden to avoid System.exit throw new QueryException( "Parser: panic" ); } }
public void end(QueryTranslatorImpl q) { if ( afterMemberDeclarations ) { //The exception throwned by the AST query translator contains the error token location, respensent by line and colum, //but it hard to get that info here. throw new QueryException( "alias not specified for IN" ); } }
public String getWhereColumn() throws QueryException { if ( columns.length != 1 ) { throw new QueryException( "path expression ends in a composite value: " + path ); } return columns[0]; }
@Override public void panic(String s) { //overriden to avoid System.exit throw new QueryException( s ); } }
public Type toType(String propertyName) throws QueryException { if ( propertyName==null || "id".equals(propertyName) ) { return type; } else { throw new QueryException("cannot dereference scalar collection element: " + propertyName); } }
private void verifyRefCursorSupport(Dialect dialect) { if ( ! supportsRefCursors ) { throw new QueryException( "Dialect [" + dialect.getClass().getName() + "] not known to support REF_CURSOR parameters" ); } }
protected final int determineJdbcTypeCode(Type type, Mapping mapping) throws QueryException { try { final int[] jdbcTypeCodes = type.sqlTypes( mapping ); if ( jdbcTypeCodes.length != 1 ) { throw new QueryException( "multiple-column type in sum()" ); } return jdbcTypeCodes[0]; } catch ( MappingException me ) { throw new QueryException( me ); } }
public QueryException buildIllegalCollectionDereferenceException(String propertyName, FromReferenceNode lhs) { String lhsPath = ASTUtil.getPathText( lhs ); return new QueryException( "illegal attempt to dereference collection [" + lhsPath + "] with element property reference [" + propertyName + "]" ); } };
private FetchReturn createFetchJoin(String tableAlias, String path) { int loc = path.indexOf( '.' ); if ( loc < 0 ) { throw new QueryException( "not a property path: " + path ); } final String ownerTableAlias = path.substring( 0, loc ); final String joinedPropertyName = path.substring( loc + 1 ); return addFetch( tableAlias, ownerTableAlias, joinedPropertyName ); }
private void checkQuery(QueryParameters queryParameters) { if ( hasSelectNew() && queryParameters.getResultTransformer() != null ) { throw new QueryException( "ResultTransformer is not allowed for 'select new' queries." ); } }
private Queryable getEntityPersisterForName(String name) throws QueryException { String type = getType( name ); Queryable persister = getEntityPersister( type ); if ( persister == null ) { throw new QueryException( "persistent class not found: " + type ); } return persister; }
public void setFetch(boolean fetch) { this.fetch = fetch; // Fetch can't be used with scroll() or iterate(). if ( fetch && getWalker().isShallowQuery() ) { throw new QueryException( QueryTranslator.ERROR_CANNOT_FETCH_WITH_ITERATE ); } }
private void addJoin(String name, AssociationType joinableType) throws QueryException { try { joinSequence.addJoin( joinableType, name, joinType, currentColumns() ); } catch ( MappingException me ) { throw new QueryException( me ); } }
private void addToCurrentJoin(PathExpressionParser.CollectionElement ce) throws QueryException { try { addToCurrentJoin( ce.joinSequence.toJoinFragment().toWhereFragmentString() + ce.indexValue.toString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }
@Override public void throwQueryException() throws QueryException { if ( getErrorCount() > 0 ) { if ( recognitionExceptions.size() > 0 ) { throw QuerySyntaxException.convert( recognitionExceptions.get( 0 ), hql ); } throw new QueryException( getErrorString(), hql ); } LOG.debug( "throwQueryException() : no errors" ); } }
Queryable getEntityPersister(String entityName) throws QueryException { try { return (Queryable) getFactory().getMetamodel().entityPersister( entityName ); } catch (Exception e) { throw new QueryException( "persistent class not found: " + entityName ); } }
protected String[] currentColumns() throws QueryException { String propertyPath = getPropertyPath(); String[] propertyColumns = getPropertyMapping().toColumns( currentName, propertyPath ); if ( propertyColumns == null ) { throw new QueryException( "could not resolve property columns: " + propertyPath ); } return propertyColumns; }
public void end(QueryTranslatorImpl q) throws QueryException { if ( expectingPathContinuation ) { expectingPathContinuation = false; PathExpressionParser.CollectionElement element = pathExpressionParser.lastCollectionElement(); if ( element.elementColumns.length != 1 ) { throw new QueryException( "path expression ended in composite collection element" ); } appendToken( q, element.elementColumns[0] ); addToCurrentJoin( element ); } token( ")", q ); }
private void addJoin(JoinSequence joinSequence, QueryTranslatorImpl q) throws QueryException { //JoinFragment fromClause = q.createJoinFragment(true); //fromClause.addJoins( join.toJoinFragment().toFromFragmentString(), StringHelper.EMPTY_STRING ); q.addFromJoinOnly( pathExpressionParser.getName(), joinSequence ); try { addToCurrentJoin( joinSequence.toJoinFragment( q.getEnabledFilters(), true ).toWhereFragmentString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }