Hibernate version: H3
Name and version of the database you are using: Oracle 9
I have a many to many relationship between users and roles that I am mapping as follows:
Code:
<set name="userRoles" table="USER_ROLE" cascade="all-delete-orphan">
<key column="USER_ID"/>
<composite-element class="com.biperf.core.domain.user.UserRole">
<parent name="user" />
<many-to-one name="role" class="com.biperf.core.domain.user.Role" column="ROLE_ID" />
<property name="auditInfo" type="com.biperf.core.utils.hibernate.AuditInfoType">
<column name="DATE_MODIFIED"/>
<column name="DATE_CREATED"/>
<column name="MODIFIED_BY"/>
<column name="CREATED_BY"/>
</property>
</composite-element>
</set>
Now when I delete a userRole from the userRoles set, Hibernate generates the following sql statment:
Code:
delete from USER_ROLE where USER_ID=? and ROLE_ID=? and DATE_MODIFIED=? and DATE_CREATED=? and MODIFIED_BY=? and CREATED_BY=?
The trouble is that modifiedBy and dateModifed can be null, and when they are the above sql statement fails.
How do I get Hibernate to generate the delete statement with only USER_ID and ROLE_ID?
Here is what I want...
Code:
delete from USER_ROLE where USER_ID=? and ROLE_ID=?
I have the issue with update statments...[/code]