What sql expression need I write to view List of objects?
Hibernate version: 2.1
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="datamodel.People" table="people">
<id name="id" column="id" type="integer" unsaved-value="null">
<generator class="hilo"/>
</id>
<property name="name" column="name" type="string" length="25" not-null="true"/>
<property name="sex" column="sex" type="string" length="1" not-null="true"/>
<property name="age" column="age" type="integer" not-null="true"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
People people1 = new People("Ivan", "M", 1);
People people2 = new People("Kuzma", "M", 2);
Transaction tx = null;
tx = session.beginTransaction();
session.save(people1);
session.save(people2);
tx.commit();
tx = session.beginTransaction();
List people = session.find("from people");
for (Iterator it = people.iterator();it.hasNext();) {
People p = (People) it.next();
System.out.println("People: " + p);
}
tx.commit();
Full stack trace of any exception that occurs:
run:
[java] 30.08.2004 14:33:22 net.sf.hibernate.cfg.Environment <clinit>
[java] INFO: Hibernate 2.1.2
[java] 30.08.2004 14:33:22 net.sf.hibernate.cfg.Environment <clinit>
[java] INFO: hibernate.properties not found
[java] 30.08.2004 14:33:22 net.sf.hibernate.cfg.Environment <clinit>
[java] INFO: using CGLIB reflection optimizer
[java] 30.08.2004 14:33:22 net.sf.hibernate.cfg.Configuration addClass
[java] INFO: Mapping resource: datamodel/People.hbm.xml
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.Binder bindRootClass
[java] INFO: Mapping class: datamodel.People -> people
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing one-to-many association mappings
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing one-to-one association property references
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing foreign key constraints
[java] 30.08.2004 14:33:23 net.sf.hibernate.dialect.Dialect <init>
[java] INFO: Using dialect: net.sf.hibernate.dialect.FirebirdDialect
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.SettingsFactory buildSettings
[java] INFO: Use outer join fetching: true
[java] 30.08.2004 14:33:23 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[java] INFO: Using Hibernate built-in connection pool (not for production use!)
[java] 30.08.2004 14:33:23 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[java] INFO: Hibernate connection pool size: 20
[java] 30.08.2004 14:33:23 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[java] INFO: using driver: org.firebirdsql.jdbc.FBDriver at URL: jdbc:firebirdsql:192.168.46.1:test
[java] 30.08.2004 14:33:23 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[java] INFO: connection properties: {user=sysdba, password=ats45system}
[java] 30.08.2004 14:33:23 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[java] INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.SettingsFactory buildSettings
[java] INFO: Use scrollable result sets: false
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.SettingsFactory buildSettings
[java] INFO: Use JDBC3 getGeneratedKeys(): false
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.SettingsFactory buildSettings
[java] INFO: Optimize cache for minimal puts: false
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.SettingsFactory buildSettings
[java] INFO: echoing all SQL to stdout
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.SettingsFactory buildSettings
[java] INFO: Query language substitutions: {}
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.SettingsFactory buildSettings
[java] INFO: cache provider: net.sf.ehcache.hibernate.Provider
[java] 30.08.2004 14:33:23 net.sf.hibernate.cfg.Configuration configureCaches
[java] INFO: instantiating and configuring caches
[java] 30.08.2004 14:33:23 net.sf.hibernate.impl.SessionFactoryImpl <init>
[java] INFO: building session factory
[java] 30.08.2004 14:33:24 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
[java] INFO: no JNDI name configured
[java] 30.08.2004 14:33:24 net.sf.hibernate.dialect.Dialect <init>
[java] INFO: Using dialect: net.sf.hibernate.dialect.FirebirdDialect
[java] 30.08.2004 14:33:24 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing one-to-many association mappings
[java] 30.08.2004 14:33:24 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing one-to-one association property references
[java] 30.08.2004 14:33:24 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing foreign key constraints
[java] 30.08.2004 14:33:24 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing one-to-many association mappings
[java] 30.08.2004 14:33:24 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing one-to-one association property references
[java] 30.08.2004 14:33:24 net.sf.hibernate.cfg.Configuration secondPassCompile
[java] INFO: processing foreign key constraints
[java] 30.08.2004 14:33:24 net.sf.hibernate.tool.hbm2ddl.SchemaExport execute
[java] INFO: Running hbm2ddl schema export
[java] 30.08.2004 14:33:24 net.sf.hibernate.tool.hbm2ddl.SchemaExport execute
[java] INFO: exporting generated schema to database
[java] 30.08.2004 14:33:24 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[java] INFO: Using Hibernate built-in connection pool (not for production use!)
[java] 30.08.2004 14:33:24 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[java] INFO: Hibernate connection pool size: 20
[java] 30.08.2004 14:33:24 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[java] INFO: using driver: org.firebirdsql.jdbc.FBDriver at URL: jdbc:firebirdsql:192.168.46.1:test
[java] 30.08.2004 14:33:24 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[java] INFO: connection properties: {user=sysdba, password=ats45system}
[java] 30.08.2004 14:33:24 net.sf.hibernate.tool.hbm2ddl.SchemaExport execute
[java] INFO: schema export complete
[java] 30.08.2004 14:33:24 net.sf.hibernate.connection.DriverManagerConnectionProvider close
[java] INFO: cleaning up connection pool: jdbc:firebirdsql:192.168.46.1:test
[java] 30.08.2004 14:33:24 net.sf.hibernate.connection.DriverManagerConnectionProvider close
[java] INFO: cleaning up connection pool: jdbc:firebirdsql:192.168.46.1:test
[java] Hibernate: insert into people (name, sex, age, id) values (?, ?, ?, ?)
[java] Hibernate: select from
[java] 30.08.2004 14:33:24 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
[java] WARNING: SQL Error: 335544569, SQLState: null
[java] 30.08.2004 14:33:24 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
[java] SEVERE: GDS Exception. Dynamic SQL Error
[java] SQL error code = -104
[java] Token unknown - line 1, char 9
[java] from
[java] 30.08.2004 14:33:24 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
[java] WARNING: SQL Error: 335544569, SQLState: null
[java] 30.08.2004 14:33:24 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
[java] SEVERE: GDS Exception. Dynamic SQL Error
[java] SQL error code = -104
[java] Token unknown - line 1, char 9
[java] from
[java] 30.08.2004 14:33:24 net.sf.hibernate.JDBCException <init>
[java] SEVERE: Could not execute query
[java] org.firebirdsql.jdbc.FBSQLException: GDS Exception. Dynamic SQL Error
[java] SQL error code = -104
[java] Token unknown - line 1, char 9
[java] from
[java] at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:82)
[java] at org.firebirdsql.jdbc.FBConnection.prepareStatement(FBConnection.java:244)
[java] at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249)
[java] at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:223)
[java] at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
[java] at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
[java] at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
[java] at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
[java] at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
[java] at net.sf.hibernate.loader.Loader.list(Loader.java:941)
[java] at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1491)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1483)
[java] at HTest.main(HTest.java:38)
[java] at org.firebirdsql.gds.GDSException: Dynamic SQL Error
[java] SQL error code = -104
[java] Token unknown - line 1, char 9
[java] from
[java] at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1698)
[java] at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1651)
[java] at org.firebirdsql.jgds.GDS_Impl.isc_dsql_prepare(GDS_Impl.java:1162)
[java] at org.firebirdsql.jca.FBManagedConnection.prepareSQL(FBManagedConnection.java:767)
[java] at org.firebirdsql.jdbc.FBConnection.prepareSQL(FBConnection.java:1110)
[java] at org.firebirdsql.jdbc.FBStatement.prepareFixedStatement(FBStatement.java:998)
[java] at org.firebirdsql.jdbc.FBPreparedStatement.prepareFixedStatement(FBPreparedStatement.java:700)
[java] at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:79)
[java] at org.firebirdsql.jdbc.FBConnection.prepareStatement(FBConnection.java:244)
[java] at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249)
[java] at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:223)
[java] at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
[java] at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
[java] at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
[java] at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
[java] at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
[java] at net.sf.hibernate.loader.Loader.list(Loader.java:941)
[java] at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1491)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1483)
[java] at HTest.main(HTest.java:38)
[java] net.sf.hibernate.JDBCException: Could not execute query
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1515)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1491)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1483)
[java] at HTest.main(HTest.java:38)
[java] Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. Dynamic SQL Error
[java] SQL error code = -104
[java] Token unknown - line 1, char 9
[java] from
[java] at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:82)
[java] at org.firebirdsql.jdbc.FBConnection.prepareStatement(FBConnection.java:244)
[java] at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249)
[java] at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:223)
[java] at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
[java] at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
[java] at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
[java] at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
[java] at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
[java] at net.sf.hibernate.loader.Loader.list(Loader.java:941)
[java] at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
[java] at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
[java] ... 3 more
BUILD SUCCESSFUL
Total time: 4 seconds
Name and version of the database you are using:
Firebird CS 1.5
Debug level Hibernate log excerpt:
log4j.rootLogger=warn, stdout
log4j.logger.net.sf.hibernate=debug
log4j.logger.net.sf.hibernate.SQL=debug
log4j.logger.net.sf.hibernate.type=debug
log4j.logger.net.sf.hibernate.tool.hbm2ddl=debug
|