Hi, I have an application working with mysql and hibernate/spring, and in one constraint in the database I have defined in the following key
Table Location
.
.
FOREIGN KEY(POWER_METER_ID_POWER_METER)
REFERENCES POWER_METER(ID_POWER_METER)
ON DELETE SET NULL
ON UPDATE NO ACTION
The problem is when I delete a row from PowerMeter table, any idea? It's a bug? or what should I do?, I have configured other tables wih DELETE CASCADE and it works fine, you can see the exception below.
Regards,
gishac
dvP
Hibernate version:
3.2
Mapping documents:
PowerMeter
-----------------------------------------------
.
.
<set name="locations" inverse="true" cascade="delete">
<key>
<column name="POWER_METER_ID_POWER_METER" not-null="true" />
</key>
<one-to-many class="sicce.api.info.Location" />
</set>
.
.
----------------------------------------------
Full stack trace of any exception that occurs:
java.lang.IllegalArgumentException: attempt to create delete event with null entity at org.hibernate.event.DeleteEvent.<init>(DeleteEvent.java:24) at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
at org.springframework.orm.hibernate3.HibernateTemplate$25.doInHibernate(HibernateTemplate.java:790)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:784)
at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:780)
at sicce.api.dataaccess.PowerMeterDAO.delete(PowerMeterDAO.java:58)
at sicce.api.dataaccess.PowerMeterDB.Delete(PowerMeterDB.java:34)
at sicce.ui.manager.forms.PowerMeterPane.Delete(PowerMeterPane.java:219)
.
.
.
|