[Teneo] Integrity constraint violation on delete [message #421969] |
Tue, 19 August 2008 18:36 |
Eclipse User |
|
|
|
Originally posted by: tskaufma.gmail.com
Hello,
I have an RCP application that uses 2 ecore models. The second model
references the first.
Simply put, the first contains a Person with attributes and references
within the model. The second model contains an Event class which has a
non-containment reference to Person objects called attendees.
What I want to do is delete a Person. When I either remove a contact from
the Resource.getContents() list or use ECoreUtils.delete(person) and then
save the resource I get an exception,
org.eclipse.emf.teneo.hibernate.HbMapperException: Exception when saving
resource DepConDataStore
at
org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:364)
at
org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:396)
....
Caused by: org.hibernate.exception.ConstraintViolationException: could not
delete: [Person#4]
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateCo nverter.java:71)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExce ptionHelper.java:43)
at
org.hibernate.persister.entity.AbstractEntityPersister.delet e(AbstractEntityPersister.java:2541)
....
Caused by: java.sql.SQLException: Integrity constraint violation
EVENT_ATTENDEES table: event_attendees in statement [delete from "contact"
where e_id=? and e_version=?]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
at
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUp date(NewProxyPreparedStatement.java:105)
at
org.hibernate.persister.entity.AbstractEntityPersister.delet e(AbstractEntityPersister.java:2523)
... 77 more
What is the right way to deal with this? Is there options I need to set? or
do I somehow need to get the 2nd model to remove its reference?
Thanks,
Trevor Kaufman
|
|
|
|
Powered by
FUDForum. Page generated in 0.03097 seconds