Java 类org.hibernate.hql.internal.ast.QuerySyntaxException 实例源码

项目:lams    文件:BasicExecutor.java   
public BasicExecutor(HqlSqlWalker walker, Queryable persister) {
    this.factory = walker.getSessionFactoryHelper().getFactory();
    this.persister = persister;
    try {
        SqlGenerator gen = new SqlGenerator( factory );
        gen.statement( walker.getAST() );
        sql = gen.getSQL();
        gen.getParseErrorHandler().throwQueryException();
        parameterSpecifications = gen.getCollectedParameters();
    }
    catch ( RecognitionException e ) {
        throw QuerySyntaxException.convert( e );
    }
}
项目:lams    文件:SessionFactoryHelper.java   
/**
 * Locate the persister by class or entity name, requiring that such a persister
 * exist.
 *
 * @param name The class or entity name
 *
 * @return The defined persister for this entity
 *
 * @throws SemanticException Indicates the persister could not be found
 */
public EntityPersister requireClassPersister(String name) throws SemanticException {
    EntityPersister cp;
    try {
        cp = findEntityPersisterByName( name );
        if ( cp == null ) {
            throw new QuerySyntaxException( name + " is not mapped" );
        }
    }
    catch ( MappingException e ) {
        throw new DetailedSemanticException( e.getMessage(), e );
    }
    return cp;
}
项目:mad-java    文件:HibernateExceptionHandler.java   
public static void rethrowAsDatastoreLogAll( final HibernateException he, final Log log, final String message )
        throws DatastoreException
{
    final String internalMess = concMess( message, he );
    if (he instanceof JDBCConnectionException || he instanceof GenericJDBCException
            || he instanceof SQLGrammarException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof ConstraintViolationException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof LockAcquisitionException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof QuerySyntaxException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof QueryException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
}
项目:mad-java    文件:HibernateExceptionHandler.java   
public static void rethrowJdbcAsDatastore( final HibernateException he, final Log log, final String message, final int logErrorMask ) // NOPMD by dan on 01/02/15 07:21
        throws DatastoreException
{
    final String internalMess = concMess( message, he );
    if (he instanceof JDBCConnectionException || he instanceof GenericJDBCException
            || he instanceof SQLGrammarException)
    {
        if ((logErrorMask & JDBC_IS_ERROR) != 0)
        {
            log.error( internalMess, he );
        }
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof ConstraintViolationException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof LockAcquisitionException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof QuerySyntaxException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
}
项目:mad-java    文件:HibernateExceptionHandler.java   
public static void rethrowJdbcAsDatastoreAndConstraintAsItself( final HibernateException he, final Log log, final String message,
        final int logErrorMask ) throws DatastoreException, MAConstraintViolationException
{
    final String internalMess = concMess( message, he );
    if (he instanceof JDBCConnectionException || he instanceof GenericJDBCException
            || he instanceof SQLGrammarException)
    {
        if ((logErrorMask & JDBC_IS_ERROR) != 0)
        {
            log.error( internalMess, he );
        }
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof ConstraintViolationException)
    {
        if ((logErrorMask & CONSTRAINT_IS_ERROR) != 0)
        {
            log.error( internalMess, he );
        }
        throw new MAConstraintViolationException( internalMess, he );
    }
    else if (he instanceof LockAcquisitionException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof QuerySyntaxException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof IdentifierGenerationException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else if (he instanceof PropertyValueException)
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
    else
    {
        log.error( internalMess, he );
        throw new DatastoreException( internalMess, he );
    }
}