Joined: Wed Jul 07, 2010 2:22 am Posts: 2
|
I am using table -per - class hierarchy mapping to persist data. Getting following exception while running in MS SQL but this works fine in Oracle
ERROR org.hibernate.util.JDBCExceptionReporter [main]:=Invalid column name 'type'.
Mapping file has the following : <class name="PRIMARY" table="PRIMARY.PRIMARY" lazy="true" batch-size="20"> <id name="pid" type="long" column="PRIMARY_PID" > <generator class="native"> <param name="sequence">PRIMARY.SQ_PRIMARY</param> </generator> </id> <discriminator column="TYPE" type="string"/> <property name="primaryAddress" type="long" column="PRIMARY_ADDRESS" not-null="false"/> <subclass name="Practice" discriminator-value="PRACT"> <property name="firstName" type="string" column="FIRSTNAME" not-null="false" /> <property name="firstNameUpper" type="string" column="FIRSTNAME_UPPER" not-null="false" access="property" /> </subclass> </class>
The Query is created in following manner: hibernateTemplate.getSessionFactory().getCurrentSession().createQuery("from Primary where type= :type").setParameter("type", primaryTypeCode);
When i check for value of primaryTypeCode i get PRACT but the generated query has stament : where type = ? instead of where PRIMARY.TYPE
Any help would be appreciated.
|
|