Teneo: Deleting with EAV schema [message #498031] |
Fri, 13 November 2009 12:50  |
Eclipse User |
|
|
|
With Teneo, what is the correct approach for deleting an EObject from the database when using EAV schema? I have the following type defined in XSD:
<xsd:complexType name="PersonType">
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string"/>
<xsd:element name="LastName" type="xsd:string"/>
<xsd:element name="Age" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
I create an EObject of that type and store it in the database, then I get it and finally delete it. The SQL query that I am using for the delete is:
"delete from PersonType where eid =:param".
I am getting the following exception:
java.sql.SQLIntegrityConstraintViolationException: DELETE on table 'eaveobject' caused a violation of foreign key constraint 'FKD71B92575D2320E0' for key (360448). The statement has been rolled back.
On the elver.org site, I've read about some limitations with EAV schema regarding database foreign key constraints. However, I'm not sure that they apply here (I just have a single complex type). Is there something that I should be doing differently?
|
|
|
Re: Teneo: Deleting with EAV schema [message #498049 is a reply to message #498031] |
Fri, 13 November 2009 16:11  |
Eclipse User |
|
|
|
Hi Andrew,
Yeah deleting should work fine and afaics you can do what you did. Another approach is to load the object from the
database and delete it using session.delete/remove.
Can you check in the database which foreign key constraint is violated?
gr. Martin
Andrew wrote:
> With Teneo, what is the correct approach for deleting an EObject from
> the database when using EAV schema? I have the following type defined
> in XSD:
>
> <xsd:complexType name="PersonType">
> <xsd:sequence>
> <xsd:element name="FirstName" type="xsd:string"/>
> <xsd:element name="LastName" type="xsd:string"/>
> <xsd:element name="Age" type="xsd:integer"/>
> </xsd:sequence>
> </xsd:complexType>
>
> I create an EObject of that type and store it in the database, then I
> get it and finally delete it. The SQL query that I am using for the
> delete is:
>
> "delete from PersonType where eid =:param".
> I am getting the following exception:
> java.sql.SQLIntegrityConstraintViolationException: DELETE on table
> 'eaveobject' caused a violation of foreign key constraint
> 'FKD71B92575D2320E0' for key (360448). The statement has been rolled back.
>
> On the elver.org site, I've read about some limitations with EAV schema
> regarding database foreign key constraints. However, I'm not sure that
> they apply here (I just have a single complex type). Is there something
> that I should be doing differently?
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.05216 seconds