Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
The generateConcreteSelectString() method in net.sf.hibernate.persister.NormalizedEntityPersister generates a sql statement which causes a sql exception: java.sql.SQLException: ORA-00936: missing expression. The mistake in the sql statement is in the "where and". This occurs whenever I do a select-before-update in a joined subclass (see the Fermenter subclass below)
Hibernate version:
2.1.8
Mapping documents:
(only relevant class shown)
<class name="Recipe" table="recipes">
<cache usage="read-write"/>
<id name="batchNo" column="recp_batch_no">
<generator class="assigned" />
</id>
<property name="changeUser" column="change_user" />
<property name="changeType" column="change_type" />
<many-to-one name="material" column="recp_matr_material_no" class="Material" not-null="true"/>
<many-to-one name="recipeType" column="recp_rect_id" class="RecipeType" not-null="true"/>
<one-to-one name="childRelation" class="RecipeRelation" property-ref="from" />
<one-to-one name="parentRelation" class="RecipeRelation" property-ref="to" />
<component name="startDate">
<property name="date" column="recp_start_date" not-null="true"/>
</component>
<property name="closed" column="recp_ind_closed" type="yes_no" not-null="true" />
<component name="endDate">
<property name="date" column="recp_end_date" />
</component>
<property name="checkedBy" column="recp_chk_by" />
<property name="checkedByDayNo" column="recp_chk_by_day_no" />
<set name="terminations" lazy="true" inverse="true" cascade="all-delete-orphan">
<key column="rete_recp_batch_no" />
<one-to-many class="RecipeTermination"/>
</set>
<!-- Fermenters -->
<joined-subclass name="Fermenter" table="fermenters" select-before-update="true">
<key column="ferm_batch_no" />
<property name="changeUser2" column="change_user" />
<property name="changeType2" column="change_type" />
<property name="backup" column="ferm_ind_backup" type="yes_no" not-null="true" /> <!-- has default value 'N' -->
<component name="drawFillDate">
<property name="date" column="ferm_draw_fill_date" />
</component>
<property name="remarks" column="ferm_remarks" />
<set name="cellCounts" lazy="true" inverse="true" order-by="obsv_sample_date desc" >
<key column="obsv_ferm_batch_no"/>
<one-to-many class="CellCount"/>
</set>
<set name="inoculations" lazy="true" inverse="true" order-by="basw_inoc_date desc">
<key column="basw_ferm_batch_no"/>
<one-to-many class="BaySwitch"/>
</set>
<set name="freezes" lazy="true" inverse="true" order-by="frze_sample_date desc">
<key column="frze_ferm_batch_no"/>
<one-to-many class="Freeze"/>
</set>
<set name="media" lazy="true" inverse="true" order-by="mesw_switch_date desc">
<key column="mesw_ferm_batch_no"/>
<one-to-many class="Medium"/>
</set>
<set name="leakages" lazy="true" inverse="true" order-by="leak_leak_date desc">
<key column="leak_ferm_batch_no"/>
<one-to-many class="Leakage"/>
</set>
</joined-subclass>
</class>
Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):
select x.ferm_batch_no, x.change_user as change_u2_2_, x.change_type as change_t3_2_, x.ferm_ind_backup as ferm_ind4_2_, x.ferm_draw_fill_date as ferm_dra5_2_, x.ferm_remarks as ferm_rem6_2_, x_1_.change_user as change_u2_0_, x_1_.change_type as change_t3_0_, x_1_.recp_matr_material_no as recp_mat4_0_, x_1_.recp_rect_id as recp_rec5_0_, x_1_.recp_start_date as recp_sta6_0_, x_1_.recp_ind_closed as recp_ind7_0_, x_1_.recp_end_date as recp_end8_0_, x_1_.recp_chk_by as recp_chk9_0_, x_1_.recp_chk_by_day_no as recp_ch10_0_ from fermenters x, recipes x_1_ where and x.ferm_batch_no=x_1_.recp_batch_nox.ferm_batch_no=?
Debug level Hibernate log excerpt: