Hi,
Is there a way to refer to entity attribute in set's where attribute?
I have a class mapping contains the following:
Code:
<property name="entityType" type="string" length="50"></property>
<map name="attachments" batch-size="1" cascade="delete-orphan"
inverse="true" [color=red]where="parentType=:entityType[/color]">
<key column="parentId"></key>
<index column="fileName" type="string" length="50"></index>
<one-to-many class="AttachmentInfo" />
</map>
Hibernate generates the following message:
Code:
select ... from ATTACHMENTS attachment0_ where attachment0_.parentId=? and attachment0_.parentType=:entityType
net.sf.hibernate.util.JDBCExceptionReporter SQL Error: 1008, SQLState: 72000
net.sf.hibernate.util.JDBCExceptionReporter ORA-01008: not all variables bound
net.sf.hibernate.util.JDBCExceptionReporter SQL Error: 1008, SQLState: 72000
net.sf.hibernate.util.JDBCExceptionReporter ORA-01008: not all variables bound
net.sf.hibernate.util.JDBCExceptionReporter could not initialize collection: [com.celestica.sea.model.Issue.attachments#1]
net.sf.hibernate.util.JDBCExceptionReporter TRAS0014I: The following exception was logged java.sql.SQLException: ORA-01008: not all variables bound
It works find if I use "where parentType='MyEntityType'".
Could anyone show me an example or point me to the doc? I've searched the forums and docs but I might have been blind. :)
Thanks in advance,
Dan