Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.0
Mapping documents:
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-
3.0.dtd">
<!-- $Header: /opt/lair/tigr/tigrconfig/default/hibernate/mapping-tigr.hbm.xml,v 1.12 2007/09/25 19:20:53 sadind Exp $-->
<!-- Generated by hibernate-build-process Tue Jul 31 13:25:40 2007-->
<hibernate-mapping>
<class name="PartyImpl" table="Party">
<id name="partyId" column="party_id" type="java.lang.Integer"></id>
<property name="frDt" column="fr_dt" type="java.sql.Timestamp" insert="true" update="true"></property>
<property name="toDt" column="to_dt" type="java.sql.Timestamp" insert="true" update="true"></property>
<property name="gsTxnLogId" column="gs_txn_log_id" type="java.lang.Integer" insert="true" update="true"></property>
<property name="partyTypeCd" column="party_type_cd" type="PartyTypeUserType" insert="true" update="true"></property>
<joined-subclass name="PersonImpl" table="Person">
<key column="party_id"></key>
<property name="officeId" column="office_id" type="java.lang.Integer" insert="false" update="false"></property>
<property name="kerberosId" column="kerberos_id" type="java.lang.String" insert="true" update="true"></property>
<property name="gsGuid" column="gs_guid" type="java.lang.String" insert="true" update="true"></property>
<property name="fullName" column="full_name" type="java.lang.String" insert="true" update="true"></property>
<property name="lastName" column="last_name" type="java.lang.String" insert="true" update="true"></property>
<property name="firstName" column="first_name" type="java.lang.String" inser
t="true" update="true"></property>
<property name="blobType" column="bio_blob_path" "BlobUserType" insert="true" up
date="true"></property>
</joined-subclass>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close(): It its trying to get a row from person based on party id
Full stack trace of any exception that occurs:
- Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
- Using ASTQueryTranslatorFactory
- Query language substitutions: {}
- JPA-QL strict compliance: disabled
- Second-level cache: enabled
- Query cache: disabled
- Cache provider: org.hibernate.cache.NoCacheProvider
- Optimize cache for minimal puts: disabled
- Structured second-level cache entries: disabled
- Echoing all SQL to stdout
- Statistics: disabled
- Deleted entity synthetic identifier rollback: disabled
- Default entity-mode: pojo
- Named query checking : enabled
- building session factory
- Not binding factory to JNDI, no JNDI name configured
Hibernate: select t1.* from Person t1 where t1.party_id = 100000009
- could not read column value from result set: fr_dt; S0022: Invalid column name 'fr_dt'.
- SQL Error: 0, SQLState: S0022
- S0022: Invalid column name 'fr_dt'.
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
at com.gs.res.common.hib.HibernateHome.findBySQL(HibernateHome.java:233)
at com.gs.res.common.hib.HibernateHome.findWhere(HibernateHome.java:242)
at com.gs.res.tigr.data.hiberimpl.HiberTest.main(HiberTest.java:13)
Caused by: java.sql.SQLException: S0022: Invalid column name 'fr_dt'.
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:536)
at com.sybase.jdbc2.tds.TdsResultSet.findColumnByLabel(TdsResultSet.java:535)
at com.sybase.jdbc2.jdbc.SybResultSet.findColumn(SybResultSet.java:538)
at com.sybase.jdbc2.jdbc.SybResultSet.getTimestamp(SybResultSet.java:412)
at org.hibernate.type.TimestampType.get(TimestampType.java:30)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 9 more
Name and version of the database you are using:
Sybase
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I am trying to use sub classes with user types - some how when i try and get the sub classes without the user types just the columns i do not get any errors . But when i add the user type in the sub class its throws the above exception.
Any idea or document that I could use to resolve this issue.
THanks,