Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » problem with DB2 schema creation with abstration
problem with DB2 schema creation with abstration [message #612675] Mon, 26 November 2007 16:46
Julia is currently offline JuliaFriend
Messages: 85
Registered: July 2009
Member
Hi Martin,

I hae a xsd with abstration and ecore:reference elements. The createSchema
call gives me this error when it runs the SQL created.

ALTER TABLE BOOKDEFINITION ADD CONSTRAINT PBLSHRDFNT_RSRCLNK FOREIGN KEY
(RESOURCELINK) REFERENCES RESOURCELINK (RESOURCELINK_ID) ON DELETE CASCADE
;

DB21034E The command was processed as an SQL statement because it was not
a
valid Command Line Processor command. During SQL processing it returned:
SQL20255N FOREIGN KEY "PBLSHRDFNT" is not valid because it would cause a
descendent table "JULIA.BOOK" to be delete-connected to its ancestor table
"JULIA.RESO" through multiple relationships with conflicting delete rules.
The
conflict is between the delete rules of constraints "JULIA.BOOK" and
"JULIA.BOOKDEFINITION.CHL" on the descendent table. Reason code = "2".
SQLSTATE=42915

The sql statement work if I remove the ON DELETE CASCADE token. Though I'm
not sure that's the correct solution. I have gotten the same error with ON
DELETE RESTRICT. It seem to be related to ecore:reference in an element
that uses substitutionGroup. I have gotten the same error in my bigger xsd
with other similiar elements.

Any thoughts on this?

Julia

Here's my sample xsd
------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
targetNamespace=" http://www.ibm.com/websphere/appserver/schemas/6.0/ibm-porta l-test.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="0.9.3.0"
xml:lang="en"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"

xmlns:portal=" http://www.ibm.com/websphere/appserver/schemas/6.0/ibm-porta l-test.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xlink="http://www.w3.org/1999/xlink">

<xs:element name="booksinlib" type="portal:BooksInLib"/>
<xs:complexType name="BooksInLib">
<xs:sequence>
<xs:element name="library" type="portal:Library" maxOccurs="unbounded">
</xs:element>
</xs:sequence>
</xs:complexType>


<xs:complexType name="Library">
<xs:sequence>
<xs:element name="library" type="portal:Library" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element ref="portal:abstract-book-definition" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="uniqueName" type="xs:ID"
use="required"/>

</xs:complexType>

<!--
book Definition
-->

<xs:element name="abstract-book-definition"
type="portal:BookDefinition" abstract="true">
</xs:element>
<xs:complexType name="BookDefinition" abstract="true">
<xs:sequence>
<xs:element name="description" type="xs:string" />
<xs:element name="location" type="xs:string" />
</xs:sequence>
<xs:attribute name="uniqueName" type="xs:ID" use="required"/>
</xs:complexType>

<xs:element name="publisher-definition"
type="portal:PublisherDefinition"
substitutionGroup="portal:abstract-book-definition">
</xs:element>
<xs:complexType name="PublisherDefinition">
<xs:complexContent>
<xs:extension base="portal:BookDefinition">
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="resource-link"
type="portal:BookDefinitionResourceLink"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>

</xs:complexType>

<xs:complexType name="BookDefinitionResourceLink">
<xs:complexContent>
<xs:extension base="portal:ResourceLink">
<xs:attribute name="bookSubject" type="xs:string">
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="ResourceLink" abstract="true">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>


<xs:element name="children-books" type="portal:ChildrenBooks"
substitutionGroup="portal:abstract-book-definition">
</xs:element>
<xs:complexType name="ChildrenBooks">
<xs:complexContent>
<xs:extension base="portal:BookDefinition">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="cartoon" type="xs:string"/>
<xs:element name="popup" type="xs:string"/>
</xs:sequence>
<xs:attribute name="publisherDefinitionRef" type="xs:IDREF"
use="required" ecore:reference="portal:PublisherDefinition" >
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:element name="adult-books" type="portal:AdultBooks"
substitutionGroup="portal:abstract-book-definition">
</xs:element>
<xs:complexType name="AdultBooks">
<xs:complexContent>
<xs:extension base="portal:BookDefinition">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="checkedout" type="xs:string"/>
<xs:element name="userid" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Previous Topic:[documentation] why are diagrams not done with EMF?
Next Topic:problem with DB2 schema creation with abstration
Goto Forum:
  


Current Time: Sun Sep 20 02:35:06 GMT 2020

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

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

Back to the top