I am attempting a one-to-many list, where the 'many' table is shared by N other objects. The 'many' table (Action class, t_action table) has a 'type_id' column that specifies a given row's relationship with the other objects. I thought I could avoid the bother of a composite key by handling the typeId specification in the mapping with the optional 'where' clause. However, I'm having trouble formatting the clause to get it to work. I've tried both the sample below, as well as
Code:
where="Action.typeId = 0"
-- both generate similar errors.
What's the trick to this clause? It really looks ideal for my needs.
Thank you!
Hibernate version: 2
Mapping documents:Code:
<list name="actions" lazy="false" cascade="all" where="t_action.type_id = 0">
<key column="instance_id"/>
<index column="idx"/>
<one-to-many class="node.Action"/>
</list>
Full stack trace of any exception that occurs:Code:
Caused by: java.sql.SQLException: Base table or view not found, message from server: "Unknown table 't_action' in where clause"
The generated SQL (show_sql=true):Code:
select <FIELDS> from t_action actions0_ where actions0_.instance_id=178 and t_action.type_id = 0