Our problem is that the generated sql MUST include quotes around the field names to make them case-sensitive, otherwise Firebird will convert them to uppercase and tell us the field does not exist...
Is it possible to tell Hibernate to quote all field names??
Hibernate version: 2.1.7
Mapping document:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="sps.data.Makler" table="MAKLER">
<id name="id" column="makler_id" type="int">
<generator class="assigned" />
</id>
<property name="accountNr" column="account_nr" type="string" />
<property name="angelegtUserId" column="angelegt_user_id" type="int" />
<property name="angelegtZeit" column="angelegt_zeit" type="timestamp" not-null="true" />
<property name="ansprechpartner" column="ansprechpartner" type="string" />
<property name="bemerkung" column="bemerkung" type="string" />
<property name="bemerkung2" column="bemerkung2" type="string" />
<property name="changeTimestamp" column="change_timestamp" type="timestamp" />
<property name="email" column="email" type="string" />
<property name="fax" column="fax" type="string" />
<property name="fibuNr" column="fibu_nr" type="string" />
<property name="gutschriftRechnung" column="gutschrift_rechnung" type="int" />
<property name="journal" column="journal" type="int" />
<property name="kurzname" column="kurzname" type="string" />
<property name="maklerRabattProz" column="makler_rabatt_proz" type="float" />
<property name="maklergruppeId" column="maklergruppe_id" type="int" />
<property name="name" column="name" type="string" not-null="true" />
<property name="name2" column="name2" type="string" />
<property name="ort" column="ort" type="string" />
<property name="plz" column="plz" type="string" />
<property name="postfach" column="postfach" type="string" />
<property name="provisionssatz" column="provisionssatz" type="float" />
<property name="rechnungskopies" column="rechnungskopies" type="int" />
<property name="rechnungsname1" column="rechnungsname_1" type="string" />
<property name="rechnungsname2" column="rechnungsname_2" type="string" />
<property name="rechnungsname3" column="rechnungsname_3" type="string" />
<property name="sammelkommission" column="sammelkommission" type="int" />
<property name="smdAgentcode" column="smd_agentcode" type="string" />
<property name="smdName" column="smd_name" type="string" />
<property name="status" column="status" type="int" />
<property name="strasse" column="strasse" type="string" />
<property name="tarifId" column="tarif_id" type="int" />
<property name="telefon" column="telefon" type="string" />
<property name="verholleistungenGesplittet" column="verholleistungen_gesplittet" type="int" />
<property name="www" column="www" type="string" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Transaction t = ses.beginTransaction();
List l = ses.find("from Makler as m order by m.id asc");
for(Iterator it = l.iterator();it.hasNext();) {
m=(Makler)it.next();
break;
}
t.commit();
Full stack trace of any exception that occurs:
17.01.2005 14:24:28 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNUNG: SQL Error: 335544569, SQLState: HY000
17.01.2005 14:24:28 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SCHWERWIEGEND: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -206
Column unknown
MAKLER0_.MAKLER_ID
At line 1, column 17.
17.01.2005 14:24:28 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNUNG: SQL Error: 335544569, SQLState: HY000
17.01.2005 14:24:28 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SCHWERWIEGEND: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -206
Column unknown
MAKLER0_.MAKLER_ID
At line 1, column 17.
Debug: ERROR: HibernateException
Debug: Could not execute query
Debug: net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:81)
Debug: net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
Debug: net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30)
Debug: net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110)
Debug: net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1556)
Debug: net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1530)
Debug: net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1522)
Debug: sps.logic.Database.holeMakler(Database.java:68)
Debug: sps.test.Main.main(Main.java:24)
Name and version of the database you are using:
Firebird 1.5
The generated SQL (show_sql=true):
Hibernate: select makler0_.makler_id as makler_id, makler0_.account_nr as account_nr, makler0_.angelegt_user_id as angelegt3_, makler0_.angelegt_zeit as angelegt4_, makler0_.ansprechpartner as ansprech5_, makler0_.bemerkung as bemerkung, makler0_.bemerkung2 as bemerkung2, makler0_.change_timestamp as change_t8_, makler0_.email as email, makler0_.fax as fax, makler0_.fibu_nr as fibu_nr, makler0_.gutschrift_rechnung as gutschr12_, makler0_.journal as journal, makler0_.kurzname as kurzname, makler0_.makler_rabatt_proz as makler_15_, makler0_.maklergruppe_id as maklerg16_, makler0_.name as name, makler0_.name2 as name2, makler0_.ort as ort, makler0_.plz as plz, makler0_.postfach as postfach, makler0_.provisionssatz as provisi22_, makler0_.rechnungskopies as rechnun23_, makler0_.rechnungsname_1 as rechnun24_, makler0_.rechnungsname_2 as rechnun25_, makler0_.rechnungsname_3 as rechnun26_, makler0_.sammelkommission as sammelk27_, makler0_.smd_agentcode as smd_age28_, makler0_.smd_name as smd_name, makler0_.status as status, makler0_.strasse as strasse, makler0_.tarif_id as tarif_id, makler0_.telefon as telefon, makler0_.verholleistungen_gesplittet as verholl34_, makler0_.www as www from MAKLER makler0_ order by makler0_.makler_id asc
Debug level Hibernate log excerpt:
7.01.2005 14:24:24 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.7
17.01.2005 14:24:24 net.sf.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connection.username=sysdba, hibernate.connection.password=masterkey, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.FirebirdDialect, hibernate.show_sql=true, hibernate.connection.url=jdbc:firebirdsql:192.168.1.50/3050:/opt/firebird/datenbank/mafelo/mafelo_sps_test.gdb, hibernate.connection.driver_class=org.firebirdsql.jdbc.FBDriver}
17.01.2005 14:24:24 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
17.01.2005 14:24:24 net.sf.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
17.01.2005 14:24:24 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: sps/data/Makler.hbm.xml
17.01.2005 14:24:25 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: sps.data.Makler -> MAKLER
17.01.2005 14:24:25 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
17.01.2005 14:24:25 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
17.01.2005 14:24:25 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
17.01.2005 14:24:25 net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.FirebirdDialect
17.01.2005 14:24:25 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: true
17.01.2005 14:24:25 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
17.01.2005 14:24:25 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
17.01.2005 14:24:25 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.firebirdsql.jdbc.FBDriver at URL: jdbc:firebirdsql:192.168.1.50/3050:/opt/firebird/datenbank/mafelo/mafelo_sps_test.gdb
17.01.2005 14:24:25 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=sysdba, password=masterkey}
17.01.2005 14:24:25 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
17.01.2005 14:24:26 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
17.01.2005 14:24:26 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
17.01.2005 14:24:26 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
17.01.2005 14:24:26 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: echoing all SQL to stdout
17.01.2005 14:24:26 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
17.01.2005 14:24:26 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
17.01.2005 14:24:26 net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
17.01.2005 14:24:26 net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
17.01.2005 14:24:27 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
|