Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Does Teneo deal with interfaces correctly?
Does Teneo deal with interfaces correctly? [message #63115] Wed, 29 November 2006 08:28 Go to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Hi Martin!

I have updated my model and now have problem during hibernate mapping
generation.

I have class IAdaptable in my model which is mapped to
org.eclipse.core.IAdaptable interface:

<eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
instanceClassName="org.eclipse.core.runtime.IAdaptable"
interface="true"/>

Also I have class that implements this Interface:
<eClassifiers xsi:type="ecore:EClass" name="Placement"
eSuperTypes="#//IAdaptable">
...
</eClassifiers>

So in generated code I have:
package com.webamg.show.inventory;

import java.util.Date;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;

public interface Placement extends EObject, IAdaptable ...

BUT when I try to create mapping I get:
<class entity-name="IAdaptable" abstract="true" lazy="false"
discriminator-value="IAdaptable" table="`iadaptable`">
<meta attribute="eclassName">IAdaptable</meta>
<meta attribute="epackage">http://www.webamg.com/show/inventory</meta>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
</class>
<subclass entity-name="Placement" abstract="false" lazy="false"
extends="IAdaptable" discriminator-value="Placement">

It's wrong for me - I need to have:
<class entity-name="Placement" abstract="false" lazy="false"
discriminator-value="Placement" table="`placement`">

Also it's wrong cause IAdaptable is just interface - not an abstract class.

Is it a bug in Teneo or I need to customize behavior via jpa or hibernate
annotations in my model?

Thanks in advance.
Ilya
Re: Does Teneo deal with interfaces correctly? [message #63165 is a reply to message #63115] Wed, 29 November 2006 12:17 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ilya,
Is Placement also mapped (it should be)?

Here is another post about this topic:
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

Can you read this post and let me know if this works for you (or not)?

gr. Martin

Ilya Klyuchnikov wrote:
> Hi Martin!
>
> I have updated my model and now have problem during hibernate mapping
> generation.
>
> I have class IAdaptable in my model which is mapped to
> org.eclipse.core.IAdaptable interface:
>
> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
> instanceClassName="org.eclipse.core.runtime.IAdaptable"
> interface="true"/>
>
> Also I have class that implements this Interface:
> <eClassifiers xsi:type="ecore:EClass" name="Placement"
> eSuperTypes="#//IAdaptable">
> ...
> </eClassifiers>
>
> So in generated code I have:
> package com.webamg.show.inventory;
>
> import java.util.Date;
>
> import org.eclipse.core.runtime.IAdaptable;
> import org.eclipse.emf.common.util.EList;
> import org.eclipse.emf.ecore.EObject;
>
> public interface Placement extends EObject, IAdaptable ...
>
> BUT when I try to create mapping I get:
> <class entity-name="IAdaptable" abstract="true" lazy="false"
> discriminator-value="IAdaptable" table="`iadaptable`">
> <meta attribute="eclassName">IAdaptable</meta>
> <meta
> attribute="epackage">http://www.webamg.com/show/inventory</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> </class>
> <subclass entity-name="Placement" abstract="false" lazy="false"
> extends="IAdaptable" discriminator-value="Placement">
>
> It's wrong for me - I need to have:
> <class entity-name="Placement" abstract="false" lazy="false"
> discriminator-value="Placement" table="`placement`">
>
> Also it's wrong cause IAdaptable is just interface - not an abstract class.
>
> Is it a bug in Teneo or I need to customize behavior via jpa or
> hibernate annotations in my model?
>
> Thanks in advance.
> Ilya
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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
Re: Does Teneo deal with interfaces correctly? [message #63195 is a reply to message #63165] Wed, 29 November 2006 13:26 Go to previous messageGo to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Hi Martin!

yes - placement is mapped but it's mapped as subclass.

Really IAdapdable is just a bridge to org.eclipse.core.IAdaptable.
IAdaptable doesn't declare any fields.

What do I need?

I want that IAdaptable would be absent in mapping cause it's just behavior
interface.

So currently I received this result:
<class entity-name="IAdaptable" abstract="true" lazy="false"
discriminator-value="IAdaptable" table="`iadaptable`">
<meta attribute="eclassName">IAdaptable</meta>
<meta attribute="epackage">http://www.webamg.com/show/inventory</meta>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
</class>
<subclass entity-name="Placement" abstract="false" lazy="false"
extends="IAdaptable" discriminator-value="Placement">
<meta attribute="eclassName">Placement</meta>
<meta attribute="epackage">http://www.webamg.com/show/inventory</meta>
<id name="id" type="long">
<column not-null="true" unique="false" name="`id`"/>
<generator class="native"/>
</id>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="tag" lazy="false" insert="true" update="true"
not-null="false" unique="true" type="java.lang.String">
<column not-null="false" unique="true" name="`tag`"/>
</property>
<property name="name" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<many-to-one name="type" entity-name="PlacementType"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`type_id`"/>
</many-to-one>
<property name="startDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`startdate`"/>
</property>
<property name="endDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`enddate`"/>
</property>
<property name="url" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`url`"/>
</property>
<many-to-one name="owner" entity-name="Placement"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`owner_id`"/>
</many-to-one>
<property name="modified" lazy="false" insert="false" update="false"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`modified`"
sql-type="timestamp"/>
</property>
<property name="revision" lazy="false" insert="false" update="false"
not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`e_version`"/>
</property>
<bag name="info" fetch="subselect" lazy="true"
cascade="merge,persist,save-update,lock,refresh"
table="placementinfo_placement">
<key update="true">
<column name="`placement_id`" not-null="true" unique="false"/>
</key>
<many-to-many entity-name="PlacementInfo" unique="false">
<column name="`placementinfo_id`" not-null="true" unique="false"/>
</many-to-many>
</bag>
<bag name="children" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="Placement"/>
</bag>
<bag name="features" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="PlacementFeature"/>
</bag>
<property name="hidden" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="boolean">
<column not-null="false" unique="false" name="`hidden`"
sql-type="boolean"/>
</property>
</subclass>

But I need the same result that was before I introduce IAdaptable into
model - previously Placement did not implement IAdaptable. So I need this
generated mapping:

<class entity-name="Placement" abstract="false" lazy="false"
discriminator-value="Placement" table="`placement`">
<meta attribute="eclassName">Placement</meta>
<meta attribute="epackage">http://www.webamg.com/show/inventory</meta>
<id name="id" type="long">
<column not-null="true" unique="false" name="`id`" />
<generator class="native" />
</id>
<discriminator column="`dtype`" type="string" />
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="tag" lazy="false" insert="true" update="true"
not-null="false" unique="true" type="java.lang.String">
<column not-null="false" unique="true" name="`tag`" />
</property>
<property name="name" lazy="false" insert="true" update="true"
not-null="true" unique="false" type="java.lang.String">
<column not-null="true" unique="false" name="`name`" />
</property>
<many-to-one name="type" entity-name="PlacementType"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`type_id`" />
</many-to-one>
<property name="startDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`startdate`" />
</property>
<property name="endDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`enddate`" />
</property>
<property name="url" lazy="false" insert="true" update="true"
not-null="true" unique="false" type="java.lang.String">
<column not-null="true" unique="false" name="`url`" />
</property>
<many-to-one name="owner" entity-name="Placement"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`owner_id`" />
</many-to-one>
<property name="modified" lazy="false" insert="false" update="false"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`modified`"
sql-type="timestamp" />
</property>
<property name="revision" lazy="false" insert="false" update="false"
not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`e_version`" />
</property>
<bag name="info" fetch="subselect" lazy="true"
cascade="merge,persist,save-update,lock,refresh"
table="placementinfo_placement">
<key update="true">
<column name="`placement_id`" not-null="true" unique="false" />
</key>
<many-to-many entity-name="PlacementInfo" unique="false">
<column name="`placementinfo_id`" not-null="true" unique="false" />
</many-to-many>
</bag>
<bag name="children" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false" />
</key>
<one-to-many entity-name="Placement" />
</bag>
<bag name="features" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false" />
</key>
<one-to-many entity-name="PlacementFeature" />
</bag>
<property name="hidden" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="boolean">
<column not-null="false" unique="false" name="`hidden`"
sql-type="boolean" />
</property>
</class>


I need no IAdaptable in generated hibernate mapping.

Is there is any way to say Teneo: it's just a behavior interface - I would
not like it in your generated mapping?

Thanks.

Martin Taal wrote:

> Hi Ilya,
> Is Placement also mapped (it should be)?

> Here is another post about this topic:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

> Can you read this post and let me know if this works for you (or not)?

> gr. Martin

> Ilya Klyuchnikov wrote:
>> Hi Martin!
>>
>> I have updated my model and now have problem during hibernate mapping
>> generation.
>>
>> I have class IAdaptable in my model which is mapped to
>> org.eclipse.core.IAdaptable interface:
>>
>> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
>> instanceClassName="org.eclipse.core.runtime.IAdaptable"
>> interface="true"/>
>>
>> Also I have class that implements this Interface:
>> <eClassifiers xsi:type="ecore:EClass" name="Placement"
>> eSuperTypes="#//IAdaptable">
>> ...
>> </eClassifiers>
>>
>> So in generated code I have:
>> package com.webamg.show.inventory;
>>
>> import java.util.Date;
>>
>> import org.eclipse.core.runtime.IAdaptable;
>> import org.eclipse.emf.common.util.EList;
>> import org.eclipse.emf.ecore.EObject;
>>
>> public interface Placement extends EObject, IAdaptable ...
>>
>> BUT when I try to create mapping I get:
>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>> discriminator-value="IAdaptable" table="`iadaptable`">
>> <meta attribute="eclassName">IAdaptable</meta>
>> <meta
>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>> <id type="long" name="e_id" column="e_id"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>
>> <meta attribute="syntheticId">true</meta>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> </class>
>> <subclass entity-name="Placement" abstract="false" lazy="false"
>> extends="IAdaptable" discriminator-value="Placement">
>>
>> It's wrong for me - I need to have:
>> <class entity-name="Placement" abstract="false" lazy="false"
>> discriminator-value="Placement" table="`placement`">
>>
>> Also it's wrong cause IAdaptable is just interface - not an abstract class.
>>
>> Is it a bug in Teneo or I need to customize behavior via jpa or
>> hibernate annotations in my model?
>>
>> Thanks in advance.
>> Ilya
>>
Re: Does Teneo deal with interfaces correctly? [message #63221 is a reply to message #63195] Wed, 29 November 2006 13:37 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ilya,
You should try to set the @MappedSuperClass annotation on IAdaptable

Just as this post says (see also my previous reaction on your post):
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

This post also gives you some background of why also interface types are mapped.

I have entered a bugzilla for Teneo to move the info from this post to elver.org.

Let me know if this does (not) work for you.

gr. Martin

Ilya Klyuchnikov wrote:
> Hi Martin!
>
> yes - placement is mapped but it's mapped as subclass.
>
> Really IAdapdable is just a bridge to org.eclipse.core.IAdaptable.
> IAdaptable doesn't declare any fields.
>
> What do I need?
>
> I want that IAdaptable would be absent in mapping cause it's just
> behavior interface.
>
> So currently I received this result:
> <class entity-name="IAdaptable" abstract="true" lazy="false"
> discriminator-value="IAdaptable" table="`iadaptable`">
> <meta attribute="eclassName">IAdaptable</meta>
> <meta
> attribute="epackage">http://www.webamg.com/show/inventory</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> </class>
> <subclass entity-name="Placement" abstract="false" lazy="false"
> extends="IAdaptable" discriminator-value="Placement">
> <meta attribute="eclassName">Placement</meta>
> <meta
> attribute="epackage">http://www.webamg.com/show/inventory</meta>
> <id name="id" type="long">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="native"/>
> </id>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="tag" lazy="false" insert="true" update="true"
> not-null="false" unique="true" type="java.lang.String">
> <column not-null="false" unique="true" name="`tag`"/>
> </property>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <many-to-one name="type" entity-name="PlacementType"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`type_id`"/>
> </many-to-one>
> <property name="startDate" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`startdate`"/>
> </property>
> <property name="endDate" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`enddate`"/>
> </property>
> <property name="url" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`url`"/>
> </property>
> <many-to-one name="owner" entity-name="Placement"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`owner_id`"/>
> </many-to-one>
> <property name="modified" lazy="false" insert="false"
> update="false" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`modified`"
> sql-type="timestamp"/>
> </property>
> <property name="revision" lazy="false" insert="false"
> update="false" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`e_version`"/>
> </property>
> <bag name="info" fetch="subselect" lazy="true"
> cascade="merge,persist,save-update,lock,refresh"
> table="placementinfo_placement">
> <key update="true">
> <column name="`placement_id`" not-null="true"
> unique="false"/>
> </key>
> <many-to-many entity-name="PlacementInfo" unique="false">
> <column name="`placementinfo_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </bag>
> <bag name="children" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`owner_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="Placement"/>
> </bag>
> <bag name="features" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`owner_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="PlacementFeature"/>
> </bag>
> <property name="hidden" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`hidden`"
> sql-type="boolean"/>
> </property>
> </subclass>
>
> But I need the same result that was before I introduce IAdaptable into
> model - previously Placement did not implement IAdaptable. So I need
> this generated mapping:
>
> <class entity-name="Placement" abstract="false" lazy="false"
> discriminator-value="Placement" table="`placement`">
> <meta attribute="eclassName">Placement</meta>
> <meta
> attribute="epackage">http://www.webamg.com/show/inventory</meta>
> <id name="id" type="long">
> <column not-null="true" unique="false" name="`id`" />
> <generator class="native" />
> </id>
> <discriminator column="`dtype`" type="string" />
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="tag" lazy="false" insert="true" update="true"
> not-null="false" unique="true" type="java.lang.String">
> <column not-null="false" unique="true" name="`tag`" />
> </property>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`name`" />
> </property>
> <many-to-one name="type" entity-name="PlacementType"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`type_id`" />
> </many-to-one>
> <property name="startDate" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`startdate`" />
> </property>
> <property name="endDate" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`enddate`" />
> </property>
> <property name="url" lazy="false" insert="true" update="true"
> not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`url`" />
> </property>
> <many-to-one name="owner" entity-name="Placement"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`owner_id`" />
> </many-to-one>
> <property name="modified" lazy="false" insert="false"
> update="false" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`modified`"
> sql-type="timestamp" />
> </property>
> <property name="revision" lazy="false" insert="false"
> update="false" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`e_version`" />
> </property>
> <bag name="info" fetch="subselect" lazy="true"
> cascade="merge,persist,save-update,lock,refresh"
> table="placementinfo_placement">
> <key update="true">
> <column name="`placement_id`" not-null="true"
> unique="false" />
> </key>
> <many-to-many entity-name="PlacementInfo" unique="false">
> <column name="`placementinfo_id`" not-null="true"
> unique="false" />
> </many-to-many>
> </bag>
> <bag name="children" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`owner_id`" not-null="false"
> unique="false" />
> </key>
> <one-to-many entity-name="Placement" />
> </bag>
> <bag name="features" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`owner_id`" not-null="false"
> unique="false" />
> </key>
> <one-to-many entity-name="PlacementFeature" />
> </bag>
> <property name="hidden" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`hidden`"
> sql-type="boolean" />
> </property>
> </class>
>
>
> I need no IAdaptable in generated hibernate mapping.
>
> Is there is any way to say Teneo: it's just a behavior interface - I
> would not like it in your generated mapping?
>
> Thanks.
>
> Martin Taal wrote:
>
>> Hi Ilya,
>> Is Placement also mapped (it should be)?
>
>> Here is another post about this topic:
>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html
>>
>
>> Can you read this post and let me know if this works for you (or not)?
>
>> gr. Martin
>
>> Ilya Klyuchnikov wrote:
>>> Hi Martin!
>>>
>>> I have updated my model and now have problem during hibernate mapping
>>> generation.
>>>
>>> I have class IAdaptable in my model which is mapped to
>>> org.eclipse.core.IAdaptable interface:
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
>>> instanceClassName="org.eclipse.core.runtime.IAdaptable"
>>> interface="true"/>
>>>
>>> Also I have class that implements this Interface:
>>> <eClassifiers xsi:type="ecore:EClass" name="Placement"
>>> eSuperTypes="#//IAdaptable">
>>> ...
>>> </eClassifiers>
>>>
>>> So in generated code I have:
>>> package com.webamg.show.inventory;
>>>
>>> import java.util.Date;
>>>
>>> import org.eclipse.core.runtime.IAdaptable;
>>> import org.eclipse.emf.common.util.EList;
>>> import org.eclipse.emf.ecore.EObject;
>>>
>>> public interface Placement extends EObject, IAdaptable ...
>>>
>>> BUT when I try to create mapping I get:
>>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>>> discriminator-value="IAdaptable" table="`iadaptable`">
>>> <meta attribute="eclassName">IAdaptable</meta>
>>> <meta
>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>
>>>
>>> <meta attribute="syntheticId">true</meta>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
>>>
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> </class>
>>> <subclass entity-name="Placement" abstract="false" lazy="false"
>>> extends="IAdaptable" discriminator-value="Placement">
>>>
>>> It's wrong for me - I need to have:
>>> <class entity-name="Placement" abstract="false" lazy="false"
>>> discriminator-value="Placement" table="`placement`">
>>>
>>> Also it's wrong cause IAdaptable is just interface - not an abstract
>>> class.
>>>
>>> Is it a bug in Teneo or I need to customize behavior via jpa or
>>> hibernate annotations in my model?
>>>
>>> Thanks in advance.
>>> Ilya
>>>
>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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
Re: Does Teneo deal with interfaces correctly? [message #63247 is a reply to message #63221] Wed, 29 November 2006 15:16 Go to previous messageGo to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
I will try

Thanks

Martin Taal wrote:

> Hi Ilya,
> You should try to set the @MappedSuperClass annotation on IAdaptable

> Just as this post says (see also my previous reaction on your post):
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

> This post also gives you some background of why also interface types are
mapped.

> I have entered a bugzilla for Teneo to move the info from this post to
elver.org.

> Let me know if this does (not) work for you.

> gr. Martin

> Ilya Klyuchnikov wrote:
>> Hi Martin!
>>
>> yes - placement is mapped but it's mapped as subclass.
>>
>> Really IAdapdable is just a bridge to org.eclipse.core.IAdaptable.
>> IAdaptable doesn't declare any fields.
>>
>> What do I need?
>>
>> I want that IAdaptable would be absent in mapping cause it's just
>> behavior interface.
>>
>> So currently I received this result:
>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>> discriminator-value="IAdaptable" table="`iadaptable`">
>> <meta attribute="eclassName">IAdaptable</meta>
>> <meta
>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>> <id type="long" name="e_id" column="e_id"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>
>> <meta attribute="syntheticId">true</meta>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> </class>
>> <subclass entity-name="Placement" abstract="false" lazy="false"
>> extends="IAdaptable" discriminator-value="Placement">
>> <meta attribute="eclassName">Placement</meta>
>> <meta
>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>> <id name="id" type="long">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="native"/>
>> </id>
>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="tag" lazy="false" insert="true" update="true"
>> not-null="false" unique="true" type="java.lang.String">
>> <column not-null="false" unique="true" name="`tag`"/>
>> </property>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <many-to-one name="type" entity-name="PlacementType"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false" name="`type_id`"/>
>> </many-to-one>
>> <property name="startDate" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`startdate`"/>
>> </property>
>> <property name="endDate" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`enddate`"/>
>> </property>
>> <property name="url" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`url`"/>
>> </property>
>> <many-to-one name="owner" entity-name="Placement"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false" name="`owner_id`"/>
>> </many-to-one>
>> <property name="modified" lazy="false" insert="false"
>> update="false" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`modified`"
>> sql-type="timestamp"/>
>> </property>
>> <property name="revision" lazy="false" insert="false"
>> update="false" not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`e_version`"/>
>> </property>
>> <bag name="info" fetch="subselect" lazy="true"
>> cascade="merge,persist,save-update,lock,refresh"
>> table="placementinfo_placement">
>> <key update="true">
>> <column name="`placement_id`" not-null="true"
>> unique="false"/>
>> </key>
>> <many-to-many entity-name="PlacementInfo" unique="false">
>> <column name="`placementinfo_id`" not-null="true"
>> unique="false"/>
>> </many-to-many>
>> </bag>
>> <bag name="children" lazy="true" cascade="all,delete-orphan">
>> <key update="true">
>> <column name="`owner_id`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="Placement"/>
>> </bag>
>> <bag name="features" lazy="true" cascade="all,delete-orphan">
>> <key update="true">
>> <column name="`owner_id`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="PlacementFeature"/>
>> </bag>
>> <property name="hidden" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="boolean">
>> <column not-null="false" unique="false" name="`hidden`"
>> sql-type="boolean"/>
>> </property>
>> </subclass>
>>
>> But I need the same result that was before I introduce IAdaptable into
>> model - previously Placement did not implement IAdaptable. So I need
>> this generated mapping:
>>
>> <class entity-name="Placement" abstract="false" lazy="false"
>> discriminator-value="Placement" table="`placement`">
>> <meta attribute="eclassName">Placement</meta>
>> <meta
>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>> <id name="id" type="long">
>> <column not-null="true" unique="false" name="`id`" />
>> <generator class="native" />
>> </id>
>> <discriminator column="`dtype`" type="string" />
>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="tag" lazy="false" insert="true" update="true"
>> not-null="false" unique="true" type="java.lang.String">
>> <column not-null="false" unique="true" name="`tag`" />
>> </property>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`name`" />
>> </property>
>> <many-to-one name="type" entity-name="PlacementType"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false" name="`type_id`" />
>> </many-to-one>
>> <property name="startDate" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`startdate`" />
>> </property>
>> <property name="endDate" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`enddate`" />
>> </property>
>> <property name="url" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`url`" />
>> </property>
>> <many-to-one name="owner" entity-name="Placement"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false" name="`owner_id`" />
>> </many-to-one>
>> <property name="modified" lazy="false" insert="false"
>> update="false" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`modified`"
>> sql-type="timestamp" />
>> </property>
>> <property name="revision" lazy="false" insert="false"
>> update="false" not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`e_version`" />
>> </property>
>> <bag name="info" fetch="subselect" lazy="true"
>> cascade="merge,persist,save-update,lock,refresh"
>> table="placementinfo_placement">
>> <key update="true">
>> <column name="`placement_id`" not-null="true"
>> unique="false" />
>> </key>
>> <many-to-many entity-name="PlacementInfo" unique="false">
>> <column name="`placementinfo_id`" not-null="true"
>> unique="false" />
>> </many-to-many>
>> </bag>
>> <bag name="children" lazy="true" cascade="all,delete-orphan">
>> <key update="true">
>> <column name="`owner_id`" not-null="false"
>> unique="false" />
>> </key>
>> <one-to-many entity-name="Placement" />
>> </bag>
>> <bag name="features" lazy="true" cascade="all,delete-orphan">
>> <key update="true">
>> <column name="`owner_id`" not-null="false"
>> unique="false" />
>> </key>
>> <one-to-many entity-name="PlacementFeature" />
>> </bag>
>> <property name="hidden" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="boolean">
>> <column not-null="false" unique="false" name="`hidden`"
>> sql-type="boolean" />
>> </property>
>> </class>
>>
>>
>> I need no IAdaptable in generated hibernate mapping.
>>
>> Is there is any way to say Teneo: it's just a behavior interface - I
>> would not like it in your generated mapping?
>>
>> Thanks.
>>
>> Martin Taal wrote:
>>
>>> Hi Ilya,
>>> Is Placement also mapped (it should be)?
>>
>>> Here is another post about this topic:
>>>
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html
>>>
>>
>>> Can you read this post and let me know if this works for you (or not)?
>>
>>> gr. Martin
>>
>>> Ilya Klyuchnikov wrote:
>>>> Hi Martin!
>>>>
>>>> I have updated my model and now have problem during hibernate mapping
>>>> generation.
>>>>
>>>> I have class IAdaptable in my model which is mapped to
>>>> org.eclipse.core.IAdaptable interface:
>>>>
>>>> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
>>>> instanceClassName="org.eclipse.core.runtime.IAdaptable"
>>>> interface="true"/>
>>>>
>>>> Also I have class that implements this Interface:
>>>> <eClassifiers xsi:type="ecore:EClass" name="Placement"
>>>> eSuperTypes="#//IAdaptable">
>>>> ...
>>>> </eClassifiers>
>>>>
>>>> So in generated code I have:
>>>> package com.webamg.show.inventory;
>>>>
>>>> import java.util.Date;
>>>>
>>>> import org.eclipse.core.runtime.IAdaptable;
>>>> import org.eclipse.emf.common.util.EList;
>>>> import org.eclipse.emf.ecore.EObject;
>>>>
>>>> public interface Placement extends EObject, IAdaptable ...
>>>>
>>>> BUT when I try to create mapping I get:
>>>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>>>> discriminator-value="IAdaptable" table="`iadaptable`">
>>>> <meta attribute="eclassName">IAdaptable</meta>
>>>> <meta
>>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>>> <id type="long" name="e_id" column="e_id"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>
>>>>
>>>> <meta attribute="syntheticId">true</meta>
>>>> <generator class="native"/>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>>>>
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> </class>
>>>> <subclass entity-name="Placement" abstract="false" lazy="false"
>>>> extends="IAdaptable" discriminator-value="Placement">
>>>>
>>>> It's wrong for me - I need to have:
>>>> <class entity-name="Placement" abstract="false" lazy="false"
>>>> discriminator-value="Placement" table="`placement`">
>>>>
>>>> Also it's wrong cause IAdaptable is just interface - not an abstract
>>>> class.
>>>>
>>>> Is it a bug in Teneo or I need to customize behavior via jpa or
>>>> hibernate annotations in my model?
>>>>
>>>> Thanks in advance.
>>>> Ilya
>>>>
>>
>>
>>
>>
Re: Does Teneo deal with interfaces correctly? [message #63271 is a reply to message #63247] Wed, 29 November 2006 15:30 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Hi Martin!

@MappedSuperclass works fine.

Thanks a lot.

Ilya

Ilya Klyuchnikov wrote:

> I will try

> Thanks

> Martin Taal wrote:

>> Hi Ilya,
>> You should try to set the @MappedSuperClass annotation on IAdaptable

>> Just as this post says (see also my previous reaction on your post):
>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

>> This post also gives you some background of why also interface types are
> mapped.

>> I have entered a bugzilla for Teneo to move the info from this post to
> elver.org.

>> Let me know if this does (not) work for you.

>> gr. Martin

>> Ilya Klyuchnikov wrote:
>>> Hi Martin!
>>>
>>> yes - placement is mapped but it's mapped as subclass.
>>>
>>> Really IAdapdable is just a bridge to org.eclipse.core.IAdaptable.
>>> IAdaptable doesn't declare any fields.
>>>
>>> What do I need?
>>>
>>> I want that IAdaptable would be absent in mapping cause it's just
>>> behavior interface.
>>>
>>> So currently I received this result:
>>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>>> discriminator-value="IAdaptable" table="`iadaptable`">
>>> <meta attribute="eclassName">IAdaptable</meta>
>>> <meta
>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>> <id type="long" name="e_id" column="e_id"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>
>>> <meta attribute="syntheticId">true</meta>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> </class>
>>> <subclass entity-name="Placement" abstract="false" lazy="false"
>>> extends="IAdaptable" discriminator-value="Placement">
>>> <meta attribute="eclassName">Placement</meta>
>>> <meta
>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>> <id name="id" type="long">
>>> <column not-null="true" unique="false" name="`id`"/>
>>> <generator class="native"/>
>>> </id>
>>> <version name="e_version" column="e_version"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="tag" lazy="false" insert="true" update="true"
>>> not-null="false" unique="true" type="java.lang.String">
>>> <column not-null="false" unique="true" name="`tag`"/>
>>> </property>
>>> <property name="name" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`name`"/>
>>> </property>
>>> <many-to-one name="type" entity-name="PlacementType"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false" name="`type_id`"/>
>>> </many-to-one>
>>> <property name="startDate" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`startdate`"/>
>>> </property>
>>> <property name="endDate" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`enddate`"/>
>>> </property>
>>> <property name="url" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`url`"/>
>>> </property>
>>> <many-to-one name="owner" entity-name="Placement"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false" name="`owner_id`"/>
>>> </many-to-one>
>>> <property name="modified" lazy="false" insert="false"
>>> update="false" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`modified`"
>>> sql-type="timestamp"/>
>>> </property>
>>> <property name="revision" lazy="false" insert="false"
>>> update="false" not-null="false" unique="false" type="int">
>>> <column not-null="false" unique="false" name="`e_version`"/>
>>> </property>
>>> <bag name="info" fetch="subselect" lazy="true"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> table="placementinfo_placement">
>>> <key update="true">
>>> <column name="`placement_id`" not-null="true"
>>> unique="false"/>
>>> </key>
>>> <many-to-many entity-name="PlacementInfo" unique="false">
>>> <column name="`placementinfo_id`" not-null="true"
>>> unique="false"/>
>>> </many-to-many>
>>> </bag>
>>> <bag name="children" lazy="true" cascade="all,delete-orphan">
>>> <key update="true">
>>> <column name="`owner_id`" not-null="false" unique="false"/>
>>> </key>
>>> <one-to-many entity-name="Placement"/>
>>> </bag>
>>> <bag name="features" lazy="true" cascade="all,delete-orphan">
>>> <key update="true">
>>> <column name="`owner_id`" not-null="false" unique="false"/>
>>> </key>
>>> <one-to-many entity-name="PlacementFeature"/>
>>> </bag>
>>> <property name="hidden" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="boolean">
>>> <column not-null="false" unique="false" name="`hidden`"
>>> sql-type="boolean"/>
>>> </property>
>>> </subclass>
>>>
>>> But I need the same result that was before I introduce IAdaptable into
>>> model - previously Placement did not implement IAdaptable. So I need
>>> this generated mapping:
>>>
>>> <class entity-name="Placement" abstract="false" lazy="false"
>>> discriminator-value="Placement" table="`placement`">
>>> <meta attribute="eclassName">Placement</meta>
>>> <meta
>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>> <id name="id" type="long">
>>> <column not-null="true" unique="false" name="`id`" />
>>> <generator class="native" />
>>> </id>
>>> <discriminator column="`dtype`" type="string" />
>>> <version name="e_version" column="e_version"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="tag" lazy="false" insert="true" update="true"
>>> not-null="false" unique="true" type="java.lang.String">
>>> <column not-null="false" unique="true" name="`tag`" />
>>> </property>
>>> <property name="name" lazy="false" insert="true" update="true"
>>> not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`name`" />
>>> </property>
>>> <many-to-one name="type" entity-name="PlacementType"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false" name="`type_id`" />
>>> </many-to-one>
>>> <property name="startDate" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`startdate`" />
>>> </property>
>>> <property name="endDate" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`enddate`" />
>>> </property>
>>> <property name="url" lazy="false" insert="true" update="true"
>>> not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`url`" />
>>> </property>
>>> <many-to-one name="owner" entity-name="Placement"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false" name="`owner_id`" />
>>> </many-to-one>
>>> <property name="modified" lazy="false" insert="false"
>>> update="false" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`modified`"
>>> sql-type="timestamp" />
>>> </property>
>>> <property name="revision" lazy="false" insert="false"
>>> update="false" not-null="false" unique="false" type="int">
>>> <column not-null="false" unique="false" name="`e_version`" />
>>> </property>
>>> <bag name="info" fetch="subselect" lazy="true"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> table="placementinfo_placement">
>>> <key update="true">
>>> <column name="`placement_id`" not-null="true"
>>> unique="false" />
>>> </key>
>>> <many-to-many entity-name="PlacementInfo" unique="false">
>>> <column name="`placementinfo_id`" not-null="true"
>>> unique="false" />
>>> </many-to-many>
>>> </bag>
>>> <bag name="children" lazy="true" cascade="all,delete-orphan">
>>> <key update="true">
>>> <column name="`owner_id`" not-null="false"
>>> unique="false" />
>>> </key>
>>> <one-to-many entity-name="Placement" />
>>> </bag>
>>> <bag name="features" lazy="true" cascade="all,delete-orphan">
>>> <key update="true">
>>> <column name="`owner_id`" not-null="false"
>>> unique="false" />
>>> </key>
>>> <one-to-many entity-name="PlacementFeature" />
>>> </bag>
>>> <property name="hidden" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="boolean">
>>> <column not-null="false" unique="false" name="`hidden`"
>>> sql-type="boolean" />
>>> </property>
>>> </class>
>>>
>>>
>>> I need no IAdaptable in generated hibernate mapping.
>>>
>>> Is there is any way to say Teneo: it's just a behavior interface - I
>>> would not like it in your generated mapping?
>>>
>>> Thanks.
>>>
>>> Martin Taal wrote:
>>>
>>>> Hi Ilya,
>>>> Is Placement also mapped (it should be)?
>>>
>>>> Here is another post about this topic:
>>>>
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html
>>>>
>>>
>>>> Can you read this post and let me know if this works for you (or not)?
>>>
>>>> gr. Martin
>>>
>>>> Ilya Klyuchnikov wrote:
>>>>> Hi Martin!
>>>>>
>>>>> I have updated my model and now have problem during hibernate mapping
>>>>> generation.
>>>>>
>>>>> I have class IAdaptable in my model which is mapped to
>>>>> org.eclipse.core.IAdaptable interface:
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
>>>>> instanceClassName="org.eclipse.core.runtime.IAdaptable"
>>>>> interface="true"/>
>>>>>
>>>>> Also I have class that implements this Interface:
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Placement"
>>>>> eSuperTypes="#//IAdaptable">
>>>>> ...
>>>>> </eClassifiers>
>>>>>
>>>>> So in generated code I have:
>>>>> package com.webamg.show.inventory;
>>>>>
>>>>> import java.util.Date;
>>>>>
>>>>> import org.eclipse.core.runtime.IAdaptable;
>>>>> import org.eclipse.emf.common.util.EList;
>>>>> import org.eclipse.emf.ecore.EObject;
>>>>>
>>>>> public interface Placement extends EObject, IAdaptable ...
>>>>>
>>>>> BUT when I try to create mapping I get:
>>>>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>>>>> discriminator-value="IAdaptable" table="`iadaptable`">
>>>>> <meta attribute="eclassName">IAdaptable</meta>
>>>>> <meta
>>>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>>>> <id type="long" name="e_id" column="e_id"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>
>>>>>
>>>>> <meta attribute="syntheticId">true</meta>
>>>>> <generator class="native"/>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>
>>>>>
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> </class>
>>>>> <subclass entity-name="Placement" abstract="false" lazy="false"
>>>>> extends="IAdaptable" discriminator-value="Placement">
>>>>>
>>>>> It's wrong for me - I need to have:
>>>>> <class entity-name="Placement" abstract="false" lazy="false"
>>>>> discriminator-value="Placement" table="`placement`">
>>>>>
>>>>> Also it's wrong cause IAdaptable is just interface - not an abstract
>>>>> class.
>>>>>
>>>>> Is it a bug in Teneo or I need to customize behavior via jpa or
>>>>> hibernate annotations in my model?
>>>>>
>>>>> Thanks in advance.
>>>>> Ilya
>>>>>
>>>
>>>
>>>
>>>
Re: Does Teneo deal with interfaces correctly? [message #596311 is a reply to message #63115] Wed, 29 November 2006 12:17 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ilya,
Is Placement also mapped (it should be)?

Here is another post about this topic:
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

Can you read this post and let me know if this works for you (or not)?

gr. Martin

Ilya Klyuchnikov wrote:
> Hi Martin!
>
> I have updated my model and now have problem during hibernate mapping
> generation.
>
> I have class IAdaptable in my model which is mapped to
> org.eclipse.core.IAdaptable interface:
>
> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
> instanceClassName="org.eclipse.core.runtime.IAdaptable"
> interface="true"/>
>
> Also I have class that implements this Interface:
> <eClassifiers xsi:type="ecore:EClass" name="Placement"
> eSuperTypes="#//IAdaptable">
> ...
> </eClassifiers>
>
> So in generated code I have:
> package com.webamg.show.inventory;
>
> import java.util.Date;
>
> import org.eclipse.core.runtime.IAdaptable;
> import org.eclipse.emf.common.util.EList;
> import org.eclipse.emf.ecore.EObject;
>
> public interface Placement extends EObject, IAdaptable ...
>
> BUT when I try to create mapping I get:
> <class entity-name="IAdaptable" abstract="true" lazy="false"
> discriminator-value="IAdaptable" table="`iadaptable`">
> <meta attribute="eclassName">IAdaptable</meta>
> <meta
> attribute="epackage">http://www.webamg.com/show/inventory</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> </class>
> <subclass entity-name="Placement" abstract="false" lazy="false"
> extends="IAdaptable" discriminator-value="Placement">
>
> It's wrong for me - I need to have:
> <class entity-name="Placement" abstract="false" lazy="false"
> discriminator-value="Placement" table="`placement`">
>
> Also it's wrong cause IAdaptable is just interface - not an abstract class.
>
> Is it a bug in Teneo or I need to customize behavior via jpa or
> hibernate annotations in my model?
>
> Thanks in advance.
> Ilya
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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
Re: Does Teneo deal with interfaces correctly? [message #596316 is a reply to message #63165] Wed, 29 November 2006 13:26 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Hi Martin!

yes - placement is mapped but it's mapped as subclass.

Really IAdapdable is just a bridge to org.eclipse.core.IAdaptable.
IAdaptable doesn't declare any fields.

What do I need?

I want that IAdaptable would be absent in mapping cause it's just behavior
interface.

So currently I received this result:
<class entity-name="IAdaptable" abstract="true" lazy="false"
discriminator-value="IAdaptable" table="`iadaptable`">
<meta attribute="eclassName">IAdaptable</meta>
<meta attribute="epackage">http://www.webamg.com/show/inventory</meta>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
</class>
<subclass entity-name="Placement" abstract="false" lazy="false"
extends="IAdaptable" discriminator-value="Placement">
<meta attribute="eclassName">Placement</meta>
<meta attribute="epackage">http://www.webamg.com/show/inventory</meta>
<id name="id" type="long">
<column not-null="true" unique="false" name="`id`"/>
<generator class="native"/>
</id>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="tag" lazy="false" insert="true" update="true"
not-null="false" unique="true" type="java.lang.String">
<column not-null="false" unique="true" name="`tag`"/>
</property>
<property name="name" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<many-to-one name="type" entity-name="PlacementType"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`type_id`"/>
</many-to-one>
<property name="startDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`startdate`"/>
</property>
<property name="endDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`enddate`"/>
</property>
<property name="url" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`url`"/>
</property>
<many-to-one name="owner" entity-name="Placement"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`owner_id`"/>
</many-to-one>
<property name="modified" lazy="false" insert="false" update="false"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`modified`"
sql-type="timestamp"/>
</property>
<property name="revision" lazy="false" insert="false" update="false"
not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`e_version`"/>
</property>
<bag name="info" fetch="subselect" lazy="true"
cascade="merge,persist,save-update,lock,refresh"
table="placementinfo_placement">
<key update="true">
<column name="`placement_id`" not-null="true" unique="false"/>
</key>
<many-to-many entity-name="PlacementInfo" unique="false">
<column name="`placementinfo_id`" not-null="true" unique="false"/>
</many-to-many>
</bag>
<bag name="children" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="Placement"/>
</bag>
<bag name="features" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="PlacementFeature"/>
</bag>
<property name="hidden" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="boolean">
<column not-null="false" unique="false" name="`hidden`"
sql-type="boolean"/>
</property>
</subclass>

But I need the same result that was before I introduce IAdaptable into
model - previously Placement did not implement IAdaptable. So I need this
generated mapping:

<class entity-name="Placement" abstract="false" lazy="false"
discriminator-value="Placement" table="`placement`">
<meta attribute="eclassName">Placement</meta>
<meta attribute="epackage">http://www.webamg.com/show/inventory</meta>
<id name="id" type="long">
<column not-null="true" unique="false" name="`id`" />
<generator class="native" />
</id>
<discriminator column="`dtype`" type="string" />
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="tag" lazy="false" insert="true" update="true"
not-null="false" unique="true" type="java.lang.String">
<column not-null="false" unique="true" name="`tag`" />
</property>
<property name="name" lazy="false" insert="true" update="true"
not-null="true" unique="false" type="java.lang.String">
<column not-null="true" unique="false" name="`name`" />
</property>
<many-to-one name="type" entity-name="PlacementType"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`type_id`" />
</many-to-one>
<property name="startDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`startdate`" />
</property>
<property name="endDate" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`enddate`" />
</property>
<property name="url" lazy="false" insert="true" update="true"
not-null="true" unique="false" type="java.lang.String">
<column not-null="true" unique="false" name="`url`" />
</property>
<many-to-one name="owner" entity-name="Placement"
cascade="merge,persist,save-update,lock,refresh" lazy="false"
insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`owner_id`" />
</many-to-one>
<property name="modified" lazy="false" insert="false" update="false"
not-null="false" unique="false" type="timestamp">
<column not-null="false" unique="false" name="`modified`"
sql-type="timestamp" />
</property>
<property name="revision" lazy="false" insert="false" update="false"
not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`e_version`" />
</property>
<bag name="info" fetch="subselect" lazy="true"
cascade="merge,persist,save-update,lock,refresh"
table="placementinfo_placement">
<key update="true">
<column name="`placement_id`" not-null="true" unique="false" />
</key>
<many-to-many entity-name="PlacementInfo" unique="false">
<column name="`placementinfo_id`" not-null="true" unique="false" />
</many-to-many>
</bag>
<bag name="children" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false" />
</key>
<one-to-many entity-name="Placement" />
</bag>
<bag name="features" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`owner_id`" not-null="false" unique="false" />
</key>
<one-to-many entity-name="PlacementFeature" />
</bag>
<property name="hidden" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="boolean">
<column not-null="false" unique="false" name="`hidden`"
sql-type="boolean" />
</property>
</class>


I need no IAdaptable in generated hibernate mapping.

Is there is any way to say Teneo: it's just a behavior interface - I would
not like it in your generated mapping?

Thanks.

Martin Taal wrote:

> Hi Ilya,
> Is Placement also mapped (it should be)?

> Here is another post about this topic:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

> Can you read this post and let me know if this works for you (or not)?

> gr. Martin

> Ilya Klyuchnikov wrote:
>> Hi Martin!
>>
>> I have updated my model and now have problem during hibernate mapping
>> generation.
>>
>> I have class IAdaptable in my model which is mapped to
>> org.eclipse.core.IAdaptable interface:
>>
>> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
>> instanceClassName="org.eclipse.core.runtime.IAdaptable"
>> interface="true"/>
>>
>> Also I have class that implements this Interface:
>> <eClassifiers xsi:type="ecore:EClass" name="Placement"
>> eSuperTypes="#//IAdaptable">
>> ...
>> </eClassifiers>
>>
>> So in generated code I have:
>> package com.webamg.show.inventory;
>>
>> import java.util.Date;
>>
>> import org.eclipse.core.runtime.IAdaptable;
>> import org.eclipse.emf.common.util.EList;
>> import org.eclipse.emf.ecore.EObject;
>>
>> public interface Placement extends EObject, IAdaptable ...
>>
>> BUT when I try to create mapping I get:
>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>> discriminator-value="IAdaptable" table="`iadaptable`">
>> <meta attribute="eclassName">IAdaptable</meta>
>> <meta
>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>> <id type="long" name="e_id" column="e_id"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>
>> <meta attribute="syntheticId">true</meta>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> </class>
>> <subclass entity-name="Placement" abstract="false" lazy="false"
>> extends="IAdaptable" discriminator-value="Placement">
>>
>> It's wrong for me - I need to have:
>> <class entity-name="Placement" abstract="false" lazy="false"
>> discriminator-value="Placement" table="`placement`">
>>
>> Also it's wrong cause IAdaptable is just interface - not an abstract class.
>>
>> Is it a bug in Teneo or I need to customize behavior via jpa or
>> hibernate annotations in my model?
>>
>> Thanks in advance.
>> Ilya
>>
Re: Does Teneo deal with interfaces correctly? [message #596323 is a reply to message #63195] Wed, 29 November 2006 13:37 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ilya,
You should try to set the @MappedSuperClass annotation on IAdaptable

Just as this post says (see also my previous reaction on your post):
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

This post also gives you some background of why also interface types are mapped.

I have entered a bugzilla for Teneo to move the info from this post to elver.org.

Let me know if this does (not) work for you.

gr. Martin

Ilya Klyuchnikov wrote:
> Hi Martin!
>
> yes - placement is mapped but it's mapped as subclass.
>
> Really IAdapdable is just a bridge to org.eclipse.core.IAdaptable.
> IAdaptable doesn't declare any fields.
>
> What do I need?
>
> I want that IAdaptable would be absent in mapping cause it's just
> behavior interface.
>
> So currently I received this result:
> <class entity-name="IAdaptable" abstract="true" lazy="false"
> discriminator-value="IAdaptable" table="`iadaptable`">
> <meta attribute="eclassName">IAdaptable</meta>
> <meta
> attribute="epackage">http://www.webamg.com/show/inventory</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> </class>
> <subclass entity-name="Placement" abstract="false" lazy="false"
> extends="IAdaptable" discriminator-value="Placement">
> <meta attribute="eclassName">Placement</meta>
> <meta
> attribute="epackage">http://www.webamg.com/show/inventory</meta>
> <id name="id" type="long">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="native"/>
> </id>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="tag" lazy="false" insert="true" update="true"
> not-null="false" unique="true" type="java.lang.String">
> <column not-null="false" unique="true" name="`tag`"/>
> </property>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <many-to-one name="type" entity-name="PlacementType"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`type_id`"/>
> </many-to-one>
> <property name="startDate" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`startdate`"/>
> </property>
> <property name="endDate" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`enddate`"/>
> </property>
> <property name="url" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`url`"/>
> </property>
> <many-to-one name="owner" entity-name="Placement"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`owner_id`"/>
> </many-to-one>
> <property name="modified" lazy="false" insert="false"
> update="false" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`modified`"
> sql-type="timestamp"/>
> </property>
> <property name="revision" lazy="false" insert="false"
> update="false" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`e_version`"/>
> </property>
> <bag name="info" fetch="subselect" lazy="true"
> cascade="merge,persist,save-update,lock,refresh"
> table="placementinfo_placement">
> <key update="true">
> <column name="`placement_id`" not-null="true"
> unique="false"/>
> </key>
> <many-to-many entity-name="PlacementInfo" unique="false">
> <column name="`placementinfo_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </bag>
> <bag name="children" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`owner_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="Placement"/>
> </bag>
> <bag name="features" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`owner_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="PlacementFeature"/>
> </bag>
> <property name="hidden" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`hidden`"
> sql-type="boolean"/>
> </property>
> </subclass>
>
> But I need the same result that was before I introduce IAdaptable into
> model - previously Placement did not implement IAdaptable. So I need
> this generated mapping:
>
> <class entity-name="Placement" abstract="false" lazy="false"
> discriminator-value="Placement" table="`placement`">
> <meta attribute="eclassName">Placement</meta>
> <meta
> attribute="epackage">http://www.webamg.com/show/inventory</meta>
> <id name="id" type="long">
> <column not-null="true" unique="false" name="`id`" />
> <generator class="native" />
> </id>
> <discriminator column="`dtype`" type="string" />
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="tag" lazy="false" insert="true" update="true"
> not-null="false" unique="true" type="java.lang.String">
> <column not-null="false" unique="true" name="`tag`" />
> </property>
> <property name="name" lazy="false" insert="true" update="true"
> not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`name`" />
> </property>
> <many-to-one name="type" entity-name="PlacementType"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`type_id`" />
> </many-to-one>
> <property name="startDate" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`startdate`" />
> </property>
> <property name="endDate" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`enddate`" />
> </property>
> <property name="url" lazy="false" insert="true" update="true"
> not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`url`" />
> </property>
> <many-to-one name="owner" entity-name="Placement"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`owner_id`" />
> </many-to-one>
> <property name="modified" lazy="false" insert="false"
> update="false" not-null="false" unique="false" type="timestamp">
> <column not-null="false" unique="false" name="`modified`"
> sql-type="timestamp" />
> </property>
> <property name="revision" lazy="false" insert="false"
> update="false" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`e_version`" />
> </property>
> <bag name="info" fetch="subselect" lazy="true"
> cascade="merge,persist,save-update,lock,refresh"
> table="placementinfo_placement">
> <key update="true">
> <column name="`placement_id`" not-null="true"
> unique="false" />
> </key>
> <many-to-many entity-name="PlacementInfo" unique="false">
> <column name="`placementinfo_id`" not-null="true"
> unique="false" />
> </many-to-many>
> </bag>
> <bag name="children" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`owner_id`" not-null="false"
> unique="false" />
> </key>
> <one-to-many entity-name="Placement" />
> </bag>
> <bag name="features" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`owner_id`" not-null="false"
> unique="false" />
> </key>
> <one-to-many entity-name="PlacementFeature" />
> </bag>
> <property name="hidden" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`hidden`"
> sql-type="boolean" />
> </property>
> </class>
>
>
> I need no IAdaptable in generated hibernate mapping.
>
> Is there is any way to say Teneo: it's just a behavior interface - I
> would not like it in your generated mapping?
>
> Thanks.
>
> Martin Taal wrote:
>
>> Hi Ilya,
>> Is Placement also mapped (it should be)?
>
>> Here is another post about this topic:
>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html
>>
>
>> Can you read this post and let me know if this works for you (or not)?
>
>> gr. Martin
>
>> Ilya Klyuchnikov wrote:
>>> Hi Martin!
>>>
>>> I have updated my model and now have problem during hibernate mapping
>>> generation.
>>>
>>> I have class IAdaptable in my model which is mapped to
>>> org.eclipse.core.IAdaptable interface:
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
>>> instanceClassName="org.eclipse.core.runtime.IAdaptable"
>>> interface="true"/>
>>>
>>> Also I have class that implements this Interface:
>>> <eClassifiers xsi:type="ecore:EClass" name="Placement"
>>> eSuperTypes="#//IAdaptable">
>>> ...
>>> </eClassifiers>
>>>
>>> So in generated code I have:
>>> package com.webamg.show.inventory;
>>>
>>> import java.util.Date;
>>>
>>> import org.eclipse.core.runtime.IAdaptable;
>>> import org.eclipse.emf.common.util.EList;
>>> import org.eclipse.emf.ecore.EObject;
>>>
>>> public interface Placement extends EObject, IAdaptable ...
>>>
>>> BUT when I try to create mapping I get:
>>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>>> discriminator-value="IAdaptable" table="`iadaptable`">
>>> <meta attribute="eclassName">IAdaptable</meta>
>>> <meta
>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>
>>>
>>> <meta attribute="syntheticId">true</meta>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>
>>>
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> </class>
>>> <subclass entity-name="Placement" abstract="false" lazy="false"
>>> extends="IAdaptable" discriminator-value="Placement">
>>>
>>> It's wrong for me - I need to have:
>>> <class entity-name="Placement" abstract="false" lazy="false"
>>> discriminator-value="Placement" table="`placement`">
>>>
>>> Also it's wrong cause IAdaptable is just interface - not an abstract
>>> class.
>>>
>>> Is it a bug in Teneo or I need to customize behavior via jpa or
>>> hibernate annotations in my model?
>>>
>>> Thanks in advance.
>>> Ilya
>>>
>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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
Re: Does Teneo deal with interfaces correctly? [message #596333 is a reply to message #63221] Wed, 29 November 2006 15:16 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
I will try

Thanks

Martin Taal wrote:

> Hi Ilya,
> You should try to set the @MappedSuperClass annotation on IAdaptable

> Just as this post says (see also my previous reaction on your post):
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

> This post also gives you some background of why also interface types are
mapped.

> I have entered a bugzilla for Teneo to move the info from this post to
elver.org.

> Let me know if this does (not) work for you.

> gr. Martin

> Ilya Klyuchnikov wrote:
>> Hi Martin!
>>
>> yes - placement is mapped but it's mapped as subclass.
>>
>> Really IAdapdable is just a bridge to org.eclipse.core.IAdaptable.
>> IAdaptable doesn't declare any fields.
>>
>> What do I need?
>>
>> I want that IAdaptable would be absent in mapping cause it's just
>> behavior interface.
>>
>> So currently I received this result:
>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>> discriminator-value="IAdaptable" table="`iadaptable`">
>> <meta attribute="eclassName">IAdaptable</meta>
>> <meta
>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>> <id type="long" name="e_id" column="e_id"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>
>> <meta attribute="syntheticId">true</meta>
>> <generator class="native"/>
>> </id>
>> <discriminator column="`dtype`" type="string"/>
>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> </class>
>> <subclass entity-name="Placement" abstract="false" lazy="false"
>> extends="IAdaptable" discriminator-value="Placement">
>> <meta attribute="eclassName">Placement</meta>
>> <meta
>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>> <id name="id" type="long">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="native"/>
>> </id>
>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="tag" lazy="false" insert="true" update="true"
>> not-null="false" unique="true" type="java.lang.String">
>> <column not-null="false" unique="true" name="`tag`"/>
>> </property>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`name`"/>
>> </property>
>> <many-to-one name="type" entity-name="PlacementType"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false" name="`type_id`"/>
>> </many-to-one>
>> <property name="startDate" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`startdate`"/>
>> </property>
>> <property name="endDate" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`enddate`"/>
>> </property>
>> <property name="url" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`url`"/>
>> </property>
>> <many-to-one name="owner" entity-name="Placement"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false" name="`owner_id`"/>
>> </many-to-one>
>> <property name="modified" lazy="false" insert="false"
>> update="false" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`modified`"
>> sql-type="timestamp"/>
>> </property>
>> <property name="revision" lazy="false" insert="false"
>> update="false" not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`e_version`"/>
>> </property>
>> <bag name="info" fetch="subselect" lazy="true"
>> cascade="merge,persist,save-update,lock,refresh"
>> table="placementinfo_placement">
>> <key update="true">
>> <column name="`placement_id`" not-null="true"
>> unique="false"/>
>> </key>
>> <many-to-many entity-name="PlacementInfo" unique="false">
>> <column name="`placementinfo_id`" not-null="true"
>> unique="false"/>
>> </many-to-many>
>> </bag>
>> <bag name="children" lazy="true" cascade="all,delete-orphan">
>> <key update="true">
>> <column name="`owner_id`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="Placement"/>
>> </bag>
>> <bag name="features" lazy="true" cascade="all,delete-orphan">
>> <key update="true">
>> <column name="`owner_id`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="PlacementFeature"/>
>> </bag>
>> <property name="hidden" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="boolean">
>> <column not-null="false" unique="false" name="`hidden`"
>> sql-type="boolean"/>
>> </property>
>> </subclass>
>>
>> But I need the same result that was before I introduce IAdaptable into
>> model - previously Placement did not implement IAdaptable. So I need
>> this generated mapping:
>>
>> <class entity-name="Placement" abstract="false" lazy="false"
>> discriminator-value="Placement" table="`placement`">
>> <meta attribute="eclassName">Placement</meta>
>> <meta
>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>> <id name="id" type="long">
>> <column not-null="true" unique="false" name="`id`" />
>> <generator class="native" />
>> </id>
>> <discriminator column="`dtype`" type="string" />
>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>> <meta attribute="syntheticVersion">true</meta>
>> </version>
>> <property name="tag" lazy="false" insert="true" update="true"
>> not-null="false" unique="true" type="java.lang.String">
>> <column not-null="false" unique="true" name="`tag`" />
>> </property>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`name`" />
>> </property>
>> <many-to-one name="type" entity-name="PlacementType"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false" name="`type_id`" />
>> </many-to-one>
>> <property name="startDate" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`startdate`" />
>> </property>
>> <property name="endDate" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`enddate`" />
>> </property>
>> <property name="url" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`url`" />
>> </property>
>> <many-to-one name="owner" entity-name="Placement"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false" name="`owner_id`" />
>> </many-to-one>
>> <property name="modified" lazy="false" insert="false"
>> update="false" not-null="false" unique="false" type="timestamp">
>> <column not-null="false" unique="false" name="`modified`"
>> sql-type="timestamp" />
>> </property>
>> <property name="revision" lazy="false" insert="false"
>> update="false" not-null="false" unique="false" type="int">
>> <column not-null="false" unique="false" name="`e_version`" />
>> </property>
>> <bag name="info" fetch="subselect" lazy="true"
>> cascade="merge,persist,save-update,lock,refresh"
>> table="placementinfo_placement">
>> <key update="true">
>> <column name="`placement_id`" not-null="true"
>> unique="false" />
>> </key>
>> <many-to-many entity-name="PlacementInfo" unique="false">
>> <column name="`placementinfo_id`" not-null="true"
>> unique="false" />
>> </many-to-many>
>> </bag>
>> <bag name="children" lazy="true" cascade="all,delete-orphan">
>> <key update="true">
>> <column name="`owner_id`" not-null="false"
>> unique="false" />
>> </key>
>> <one-to-many entity-name="Placement" />
>> </bag>
>> <bag name="features" lazy="true" cascade="all,delete-orphan">
>> <key update="true">
>> <column name="`owner_id`" not-null="false"
>> unique="false" />
>> </key>
>> <one-to-many entity-name="PlacementFeature" />
>> </bag>
>> <property name="hidden" lazy="false" insert="true" update="true"
>> not-null="false" unique="false" type="boolean">
>> <column not-null="false" unique="false" name="`hidden`"
>> sql-type="boolean" />
>> </property>
>> </class>
>>
>>
>> I need no IAdaptable in generated hibernate mapping.
>>
>> Is there is any way to say Teneo: it's just a behavior interface - I
>> would not like it in your generated mapping?
>>
>> Thanks.
>>
>> Martin Taal wrote:
>>
>>> Hi Ilya,
>>> Is Placement also mapped (it should be)?
>>
>>> Here is another post about this topic:
>>>
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html
>>>
>>
>>> Can you read this post and let me know if this works for you (or not)?
>>
>>> gr. Martin
>>
>>> Ilya Klyuchnikov wrote:
>>>> Hi Martin!
>>>>
>>>> I have updated my model and now have problem during hibernate mapping
>>>> generation.
>>>>
>>>> I have class IAdaptable in my model which is mapped to
>>>> org.eclipse.core.IAdaptable interface:
>>>>
>>>> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
>>>> instanceClassName="org.eclipse.core.runtime.IAdaptable"
>>>> interface="true"/>
>>>>
>>>> Also I have class that implements this Interface:
>>>> <eClassifiers xsi:type="ecore:EClass" name="Placement"
>>>> eSuperTypes="#//IAdaptable">
>>>> ...
>>>> </eClassifiers>
>>>>
>>>> So in generated code I have:
>>>> package com.webamg.show.inventory;
>>>>
>>>> import java.util.Date;
>>>>
>>>> import org.eclipse.core.runtime.IAdaptable;
>>>> import org.eclipse.emf.common.util.EList;
>>>> import org.eclipse.emf.ecore.EObject;
>>>>
>>>> public interface Placement extends EObject, IAdaptable ...
>>>>
>>>> BUT when I try to create mapping I get:
>>>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>>>> discriminator-value="IAdaptable" table="`iadaptable`">
>>>> <meta attribute="eclassName">IAdaptable</meta>
>>>> <meta
>>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>>> <id type="long" name="e_id" column="e_id"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>
>>>>
>>>> <meta attribute="syntheticId">true</meta>
>>>> <generator class="native"/>
>>>> </id>
>>>> <discriminator column="`dtype`" type="string"/>
>>>> <version name="e_version" column="e_version"
>>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>
>>>>
>>>> <meta attribute="syntheticVersion">true</meta>
>>>> </version>
>>>> </class>
>>>> <subclass entity-name="Placement" abstract="false" lazy="false"
>>>> extends="IAdaptable" discriminator-value="Placement">
>>>>
>>>> It's wrong for me - I need to have:
>>>> <class entity-name="Placement" abstract="false" lazy="false"
>>>> discriminator-value="Placement" table="`placement`">
>>>>
>>>> Also it's wrong cause IAdaptable is just interface - not an abstract
>>>> class.
>>>>
>>>> Is it a bug in Teneo or I need to customize behavior via jpa or
>>>> hibernate annotations in my model?
>>>>
>>>> Thanks in advance.
>>>> Ilya
>>>>
>>
>>
>>
>>
Re: Does Teneo deal with interfaces correctly? [message #596343 is a reply to message #63247] Wed, 29 November 2006 15:30 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Hi Martin!

@MappedSuperclass works fine.

Thanks a lot.

Ilya

Ilya Klyuchnikov wrote:

> I will try

> Thanks

> Martin Taal wrote:

>> Hi Ilya,
>> You should try to set the @MappedSuperClass annotation on IAdaptable

>> Just as this post says (see also my previous reaction on your post):
>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html

>> This post also gives you some background of why also interface types are
> mapped.

>> I have entered a bugzilla for Teneo to move the info from this post to
> elver.org.

>> Let me know if this does (not) work for you.

>> gr. Martin

>> Ilya Klyuchnikov wrote:
>>> Hi Martin!
>>>
>>> yes - placement is mapped but it's mapped as subclass.
>>>
>>> Really IAdapdable is just a bridge to org.eclipse.core.IAdaptable.
>>> IAdaptable doesn't declare any fields.
>>>
>>> What do I need?
>>>
>>> I want that IAdaptable would be absent in mapping cause it's just
>>> behavior interface.
>>>
>>> So currently I received this result:
>>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>>> discriminator-value="IAdaptable" table="`iadaptable`">
>>> <meta attribute="eclassName">IAdaptable</meta>
>>> <meta
>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>> <id type="long" name="e_id" column="e_id"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>
>>> <meta attribute="syntheticId">true</meta>
>>> <generator class="native"/>
>>> </id>
>>> <discriminator column="`dtype`" type="string"/>
>>> <version name="e_version" column="e_version"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> </class>
>>> <subclass entity-name="Placement" abstract="false" lazy="false"
>>> extends="IAdaptable" discriminator-value="Placement">
>>> <meta attribute="eclassName">Placement</meta>
>>> <meta
>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>> <id name="id" type="long">
>>> <column not-null="true" unique="false" name="`id`"/>
>>> <generator class="native"/>
>>> </id>
>>> <version name="e_version" column="e_version"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="tag" lazy="false" insert="true" update="true"
>>> not-null="false" unique="true" type="java.lang.String">
>>> <column not-null="false" unique="true" name="`tag`"/>
>>> </property>
>>> <property name="name" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`name`"/>
>>> </property>
>>> <many-to-one name="type" entity-name="PlacementType"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false" name="`type_id`"/>
>>> </many-to-one>
>>> <property name="startDate" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`startdate`"/>
>>> </property>
>>> <property name="endDate" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`enddate`"/>
>>> </property>
>>> <property name="url" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`url`"/>
>>> </property>
>>> <many-to-one name="owner" entity-name="Placement"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false" name="`owner_id`"/>
>>> </many-to-one>
>>> <property name="modified" lazy="false" insert="false"
>>> update="false" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`modified`"
>>> sql-type="timestamp"/>
>>> </property>
>>> <property name="revision" lazy="false" insert="false"
>>> update="false" not-null="false" unique="false" type="int">
>>> <column not-null="false" unique="false" name="`e_version`"/>
>>> </property>
>>> <bag name="info" fetch="subselect" lazy="true"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> table="placementinfo_placement">
>>> <key update="true">
>>> <column name="`placement_id`" not-null="true"
>>> unique="false"/>
>>> </key>
>>> <many-to-many entity-name="PlacementInfo" unique="false">
>>> <column name="`placementinfo_id`" not-null="true"
>>> unique="false"/>
>>> </many-to-many>
>>> </bag>
>>> <bag name="children" lazy="true" cascade="all,delete-orphan">
>>> <key update="true">
>>> <column name="`owner_id`" not-null="false" unique="false"/>
>>> </key>
>>> <one-to-many entity-name="Placement"/>
>>> </bag>
>>> <bag name="features" lazy="true" cascade="all,delete-orphan">
>>> <key update="true">
>>> <column name="`owner_id`" not-null="false" unique="false"/>
>>> </key>
>>> <one-to-many entity-name="PlacementFeature"/>
>>> </bag>
>>> <property name="hidden" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="boolean">
>>> <column not-null="false" unique="false" name="`hidden`"
>>> sql-type="boolean"/>
>>> </property>
>>> </subclass>
>>>
>>> But I need the same result that was before I introduce IAdaptable into
>>> model - previously Placement did not implement IAdaptable. So I need
>>> this generated mapping:
>>>
>>> <class entity-name="Placement" abstract="false" lazy="false"
>>> discriminator-value="Placement" table="`placement`">
>>> <meta attribute="eclassName">Placement</meta>
>>> <meta
>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>> <id name="id" type="long">
>>> <column not-null="true" unique="false" name="`id`" />
>>> <generator class="native" />
>>> </id>
>>> <discriminator column="`dtype`" type="string" />
>>> <version name="e_version" column="e_version"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>
>>> <meta attribute="syntheticVersion">true</meta>
>>> </version>
>>> <property name="tag" lazy="false" insert="true" update="true"
>>> not-null="false" unique="true" type="java.lang.String">
>>> <column not-null="false" unique="true" name="`tag`" />
>>> </property>
>>> <property name="name" lazy="false" insert="true" update="true"
>>> not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`name`" />
>>> </property>
>>> <many-to-one name="type" entity-name="PlacementType"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false" name="`type_id`" />
>>> </many-to-one>
>>> <property name="startDate" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`startdate`" />
>>> </property>
>>> <property name="endDate" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`enddate`" />
>>> </property>
>>> <property name="url" lazy="false" insert="true" update="true"
>>> not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`url`" />
>>> </property>
>>> <many-to-one name="owner" entity-name="Placement"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false" name="`owner_id`" />
>>> </many-to-one>
>>> <property name="modified" lazy="false" insert="false"
>>> update="false" not-null="false" unique="false" type="timestamp">
>>> <column not-null="false" unique="false" name="`modified`"
>>> sql-type="timestamp" />
>>> </property>
>>> <property name="revision" lazy="false" insert="false"
>>> update="false" not-null="false" unique="false" type="int">
>>> <column not-null="false" unique="false" name="`e_version`" />
>>> </property>
>>> <bag name="info" fetch="subselect" lazy="true"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> table="placementinfo_placement">
>>> <key update="true">
>>> <column name="`placement_id`" not-null="true"
>>> unique="false" />
>>> </key>
>>> <many-to-many entity-name="PlacementInfo" unique="false">
>>> <column name="`placementinfo_id`" not-null="true"
>>> unique="false" />
>>> </many-to-many>
>>> </bag>
>>> <bag name="children" lazy="true" cascade="all,delete-orphan">
>>> <key update="true">
>>> <column name="`owner_id`" not-null="false"
>>> unique="false" />
>>> </key>
>>> <one-to-many entity-name="Placement" />
>>> </bag>
>>> <bag name="features" lazy="true" cascade="all,delete-orphan">
>>> <key update="true">
>>> <column name="`owner_id`" not-null="false"
>>> unique="false" />
>>> </key>
>>> <one-to-many entity-name="PlacementFeature" />
>>> </bag>
>>> <property name="hidden" lazy="false" insert="true" update="true"
>>> not-null="false" unique="false" type="boolean">
>>> <column not-null="false" unique="false" name="`hidden`"
>>> sql-type="boolean" />
>>> </property>
>>> </class>
>>>
>>>
>>> I need no IAdaptable in generated hibernate mapping.
>>>
>>> Is there is any way to say Teneo: it's just a behavior interface - I
>>> would not like it in your generated mapping?
>>>
>>> Thanks.
>>>
>>> Martin Taal wrote:
>>>
>>>> Hi Ilya,
>>>> Is Placement also mapped (it should be)?
>>>
>>>> Here is another post about this topic:
>>>>
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01437.html
>>>>
>>>
>>>> Can you read this post and let me know if this works for you (or not)?
>>>
>>>> gr. Martin
>>>
>>>> Ilya Klyuchnikov wrote:
>>>>> Hi Martin!
>>>>>
>>>>> I have updated my model and now have problem during hibernate mapping
>>>>> generation.
>>>>>
>>>>> I have class IAdaptable in my model which is mapped to
>>>>> org.eclipse.core.IAdaptable interface:
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="IAdaptable"
>>>>> instanceClassName="org.eclipse.core.runtime.IAdaptable"
>>>>> interface="true"/>
>>>>>
>>>>> Also I have class that implements this Interface:
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Placement"
>>>>> eSuperTypes="#//IAdaptable">
>>>>> ...
>>>>> </eClassifiers>
>>>>>
>>>>> So in generated code I have:
>>>>> package com.webamg.show.inventory;
>>>>>
>>>>> import java.util.Date;
>>>>>
>>>>> import org.eclipse.core.runtime.IAdaptable;
>>>>> import org.eclipse.emf.common.util.EList;
>>>>> import org.eclipse.emf.ecore.EObject;
>>>>>
>>>>> public interface Placement extends EObject, IAdaptable ...
>>>>>
>>>>> BUT when I try to create mapping I get:
>>>>> <class entity-name="IAdaptable" abstract="true" lazy="false"
>>>>> discriminator-value="IAdaptable" table="`iadaptable`">
>>>>> <meta attribute="eclassName">IAdaptable</meta>
>>>>> <meta
>>>>> attribute="epackage">http://www.webamg.com/show/inventory</meta>
>>>>> <id type="long" name="e_id" column="e_id"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
>>>
>>>>>
>>>>> <meta attribute="syntheticId">true</meta>
>>>>> <generator class="native"/>
>>>>> </id>
>>>>> <discriminator column="`dtype`" type="string"/>
>>>>> <version name="e_version" column="e_version"
>>>
>
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
>>>
>>>>>
>>>>> <meta attribute="syntheticVersion">true</meta>
>>>>> </version>
>>>>> </class>
>>>>> <subclass entity-name="Placement" abstract="false" lazy="false"
>>>>> extends="IAdaptable" discriminator-value="Placement">
>>>>>
>>>>> It's wrong for me - I need to have:
>>>>> <class entity-name="Placement" abstract="false" lazy="false"
>>>>> discriminator-value="Placement" table="`placement`">
>>>>>
>>>>> Also it's wrong cause IAdaptable is just interface - not an abstract
>>>>> class.
>>>>>
>>>>> Is it a bug in Teneo or I need to customize behavior via jpa or
>>>>> hibernate annotations in my model?
>>>>>
>>>>> Thanks in advance.
>>>>> Ilya
>>>>>
>>>
>>>
>>>
>>>
Previous Topic:Does Teneo deal with interfaces correctly?
Next Topic:CDO Errors after installation
Goto Forum:
  


Current Time: Thu Apr 25 11:51:30 GMT 2024

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

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

Back to the top