Thanks max.
Here is the debug output, and the SQL does look a little suspect (or at least it's not a syntax I'm familiar with). It is certainly different from the SQL that shows up in the "Dynamic SQL Preview" view.
However, the SQL that shows up when I run a Java program that passes the same string to createQuery() looks the same as below, so I guess it must be something else. This is from the Java code run:
Code:
2007-02-15 21:59:06,390 [main] DEBUG org.hibernate.SQL - select * from ( select rlgc0_.KEYCOL as col_0_0_ from RLGDB.RLG_COMPANY rlgc0_ ) where rownum <= ?
Can you tell why this query would not work in the HQL Query window but work fine when the same string is passed to createQuery()?
From the Hibernate Log console view:
Code:
2007-02-15 16:45:36,921 INFO Worker-6 org.hibernate.cfg.Configuration - configuring from file: hibernate.cfg.xml
2007-02-15 16:45:37,500 INFO Worker-6 org.hibernate.cfg.Configuration - Reading mappings from resource: com/company/rlg/hibernate/CoAdesind.hbm.xml
2007-02-15 16:45:37,593 INFO Worker-6 org.hibernate.cfg.HbmBinder - Mapping class: com.company.rlg.hibernate.CoAdesind -> CO_ADESIND
2007-02-15 16:45:37,609 INFO Worker-6 org.hibernate.cfg.Configuration - Reading mappings from resource: com/company/rlg/hibernate/RlgAnnfund.hbm.xml
2007-02-15 16:45:37,640 INFO Worker-6 org.hibernate.cfg.HbmBinder - Mapping class: com.company.rlg.hibernate.RlgAnnfund -> RLG_ANNFUND
2007-02-15 16:45:37,640 INFO Worker-6 org.hibernate.cfg.Configuration - Reading mappings from resource: com/company/rlg/hibernate/RlgCompany.hbm.xml
2007-02-15 16:45:37,671 INFO Worker-6 org.hibernate.cfg.HbmBinder - Mapping class: com.company.rlg.hibernate.RlgCompany -> RLG_COMPANY
2007-02-15 16:45:37,671 INFO Worker-6 org.hibernate.cfg.Configuration - Reading mappings from resource: com/company/rlg/hibernate/RlgDprc.hbm.xml
2007-02-15 16:45:37,687 INFO Worker-6 org.hibernate.cfg.HbmBinder - Mapping class: com.company.rlg.hibernate.RlgDprc -> RLG_DPRC
2007-02-15 16:45:37,687 INFO Worker-6 org.hibernate.cfg.Configuration - Reading mappings from resource: com/company/rlg/hibernate/RlgQtrfund.hbm.xml
2007-02-15 16:45:37,703 INFO Worker-6 org.hibernate.cfg.HbmBinder - Mapping class: com.company.rlg.hibernate.RlgQtrfund -> RLG_QTRFUND
2007-02-15 16:45:37,703 INFO Worker-6 org.hibernate.cfg.Configuration - Reading mappings from resource: com/company/rlg/hibernate/RlgSecurity.hbm.xml
2007-02-15 16:45:37,703 INFO Worker-6 org.hibernate.cfg.HbmBinder - Mapping class: com.company.rlg.hibernate.RlgSecurity -> RLG_SECURITY
2007-02-15 16:45:37,703 INFO Worker-6 org.hibernate.cfg.Configuration - Configured SessionFactory: null
2007-02-15 16:45:39,796 INFO Worker-4 org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
2007-02-15 16:45:39,796 INFO Worker-4 org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
2007-02-15 16:45:39,796 INFO Worker-4 org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
2007-02-15 16:45:39,796 INFO Worker-4 org.hibernate.connection.DriverManagerConnectionProvider - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@grolsch.company.com:1521:riskatl
2007-02-15 16:45:39,796 INFO Worker-4 org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=rlgdb, password=****}
2007-02-15 16:45:40,796 INFO Worker-4 org.hibernate.cfg.SettingsFactory - RDBMS: Oracle, version: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
2007-02-15 16:45:40,796 INFO Worker-4 org.hibernate.cfg.SettingsFactory - JDBC driver: Oracle JDBC driver, version: 10.2.0.2.0
2007-02-15 16:45:40,828 INFO Worker-4 org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.OracleDialect
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Connection release mode: auto
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Default schema: RLGDB
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Query cache: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Cache provider: org.hibernate.cache.NoCacheProvider
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Statistics: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
2007-02-15 16:45:40,843 INFO Worker-4 org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
2007-02-15 16:45:40,906 INFO Worker-4 org.hibernate.impl.SessionFactoryImpl - building session factory
2007-02-15 16:45:41,500 INFO Worker-4 org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.ConnectionManager - opening JDBC connection
2007-02-15 16:47:38,781 DEBUG main org.hibernate.SQL - select * from ( select rlgc0_.KEYCOL as col_0_0_ from RLGDB.RLG_COMPANY rlgc0_ ) where rownum <= ?
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.AbstractBatcher - preparing statement
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.AbstractBatcher - closing statement
2007-02-15 16:47:38,781 WARN main org.hibernate.util.JDBCExceptionReporter - SQL Error: 17003, SQLState: null
2007-02-15 16:47:38,781 ERROR main org.hibernate.util.JDBCExceptionReporter - Invalid column index
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.JDBCContext - after autocommit
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2007-02-15 16:47:38,781 DEBUG main org.hibernate.jdbc.ConnectionManager - connection already null in cleanup : no action
Cheers...