Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Teneo: Deleting with EAV schema
Teneo: Deleting with EAV schema [message #498031] Fri, 13 November 2009 17:50 Go to next message
Andrew  is currently offline Andrew Friend
Messages: 5
Registered: November 2009
Junior Member
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 21:11 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
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
Previous Topic:Autogenerate ID for EMF objects
Next Topic:generating an ecore file/model from an existing POJO web project
Goto Forum:
  


Current Time: Fri Apr 26 05:40:40 GMT 2024

Powered by FUDForum. Page generated in 0.02857 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top