|
The mapping file:
<hibernate-mapping package="org.hibernate.test.collection.set">
<class name="PersonInfoEntity" table="PersonInfo">
<id name="id" column="ID" type="long" />
<set name="Infos">
<key column="entity_id" />
<element type="org.hibernate.test.collection.set.PersonInfoType" >
<column name="height"/>
<column name="hair_color"/>
</element>
</set>
</class>
</hibernate-mapping>
Hibernate generates a table PersonInfo_Infos for the Set. This table doesn't explicitly set a primary key. Here is the table created by Hibernate:
create table PersonInfo_Infos (
entity_id bigint not null,
height integer,
hair_color varchar(255)
)
Hibernate adds all three columns (entity_id, height, hair_color) to the primary columns and Hibernate assume the primary column doesn't have any null value. That's why the delete statement is in the format "column=?" not "column is null".
|