Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo]foreign key element in jdo not generated properly?
[Teneo]foreign key element in jdo not generated properly? [message #610170] Tue, 30 October 2007 17:34
Vladimir Nikolov is currently offline Vladimir NikolovFriend
Messages: 10
Registered: July 2009
Junior Member
Hello,

I'm using Teneo/JPOX and I'm observing a behaviour which I'm not sure
that is quite correct and I want to make sure with you that I'm not
mistaken.

After I generated the jdo file with
org.eclipse.emf.teneo.jpox.mapper.GenerateJDO class I noticed that
delete-action and update-action attributes of foreign keys with
non-containment relationship are missing. I found out that only the
foreign keys which represent containment relationship have
delete-action="cascade" set. The element with non-containment(the
relationship is achieved with xs:IDREF->xs:ID) has no such attributes.
By looking in elver.org I realized that this is the default behavior so
I tried to override it by setting SET_DEFAULT_CASCADE_ON_NON_CONTAINMENT
to TRUE. However, that setting did not help. The generated jdo element
was the same.

Here is my ant for generating the jdo:
<java
classname="org.eclipse.emf.teneo.jpox.mapper.GenerateJDO"
classpathref="teneo.jpox.classpath" fork="true" failonerror="true">
<arg value="package.jdo"/>
<arg value="${dir.genModel}/library.ecore"/>
<arg value="${dir.genModel}/base.ecore"/>
<arg
value=" -com.mycompany.library.MyLibraryPackage,com.mycompany.base.B asePackage "/>
<arg value="+teneo.mapping.fetch_containment_eagerly,true"/>
<arg value="+teneo.naming.join_column_naming_strategy,simple"/>
<arg value="+teneo.naming.max_sql_name_length,18"/>
<arg
value="+teneo.mapping.set_default_cascade_on_non_containment, true"/>
</java>


Here is part of the XML schema:

<xs:complexType name="Book">
<xs:sequence>
<xs:element name="title" type="base:Text" minOccurs="0"/>
<xs:element name="description" type="base:Text" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="uniqueName" type="xs:string" use="optional"/>
<xs:attribute name="authorRef" type="xs:IDREF" use="required"
ecore:reference="library:Author"/>
<xs:attribute name="keyword" type="xs:string" use="optional"/>
</xs:complexType>

<xs:complexType name="Author">
<xs:attribute name="uniqueName" type="xs:ID" use="required" />
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>


Here is how jdo elements are generated:

<class name="com.mycompany.library.impl.BookImpl" requires-extent="true"
persistence-modifier="persistence-capable" detachable="true"
table="book" identity-type="datastore">
<implements name="com.mycompany.library.Book"/>
<implements name="org.eclipse.emf.ecore.EObject"/>
<implements name="org.eclipse.emf.common.notify.Notifier"/>
<inheritance strategy="new-table">
<discriminator column="dtype" strategy="value-map"
value="Book"/>
</inheritance>
<version strategy="version-number" column="e_version"/>
<field name="title" persistence-modifier="persistent"
dependent="true" delete-action="restrict" null-value="none">
<foreign-key delete-action="cascade"
update-action="cascade" name="book_titl"/>
<column name="title" allows-null="true"/>
<extension vendor-name="jpox" key="implementation-classes"
value="com.mycompany.base.impl.TextImpl"/>
</field>
<field name="description" persistence-modifier="persistent"
dependent="true" delete-action="restrict" null-value="none">
<foreign-key delete-action="cascade"
update-action="cascade" name="book_dscrptn"/>
<column name="description" allows-null="true"/>
<extension vendor-name="jpox" key="implementation-classes"
value="com.mycompany.base.impl.TextImpl"/>
</field>
<field name="keyword" persistence-modifier="persistent"
null-value="none"/>
<field name="authorRef" persistence-modifier="persistent"
delete-action="restrict" null-value="exception">
<foreign-key name="book_authrr"/>
<column name="authorref" allows-null="false"/>
<extension vendor-name="jpox" key="implementation-classes"
value="com.mycompany.impl.AuthorImpl"/>
<extension vendor-name="jpox" key="implementation-classes"
value="com.mycompany.impl.AuthorImpl"/>
</field>
...
</class>

Do you have any idea why the foreign key element is not generated with
proper attributes?

Thanks,
Vladimir
Previous Topic:[TENEO] How to avoid mapping of transient EReferences?
Next Topic:[Teneo] comparison byte[] with Byte[]
Goto Forum:
  


Current Time: Tue Apr 23 00:22:34 GMT 2024

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

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

Back to the top