Hi,
I have a one-to-many relationship beteween Team and Player where cascade=none
Code:
<set name="players" cascade="none" inverse="false" lazy="true">
<key column="team_id" />
<one-to-many class="hibernate.PlayerVO" />
</set>
In the following code, I loaded a Team from database and deleted it.
Code:
TeamVO t = new TeamVO();
session.load(t, new Long(62));
session.delete(t);
But Hibernate set "null" in the "team_id" column in the Player table.
But why this code doesn't throw an exception ? like this:
"ORA-02292: integrity constraint (SCOTT.FKE294C1B2AA36363D) violated - child".
You can't remove a parent that contains children.
cascade is set to "none", so why is this happening?
Hibernate: select teamvo0_.team_id as team_id, teamvo0_.team_name as team_name, teamvo0_.city as city from teams teamvo0_ where teamvo0_.team_id=?
Hibernate: update players set team_id=null where team_id=?
Hibernate: delete from teams where team_id=?
thanks very much!