Home » Modeling » EMF » [Teneo] migrating from 0.8.0 to 1.0.2, Indexed is true but indexed is not supported for inverse=true
[Teneo] migrating from 0.8.0 to 1.0.2, Indexed is true but indexed is not supported for inverse=true [message #426581] |
Wed, 14 January 2009 16:01 |
Jesper Wermuth Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hi,
I am (trying to) move the the latest teneo version in a running project.
Project contains live data, so a clean start is not an option.
The project involves several models, one of which contains users that
belong to organisations. One user can belong to several organisations.
Expressed in xsd this becomes:
<xsd:complexType name="User">
<xsd:sequence>
...
<xsd:element name="organizations" type="domain:Organization"
maxOccurs="unbounded" minOccurs="1"
ecore:reference="domain:Organization" ecore:opposite="users">
</xsd:element>
</xsd:sequence>
....
</xsd:complexType>
<xsd:complexType name="Organization">
<xsd:sequence>
<xsd:element name="users" type="domain:User"
maxOccurs="unbounded" minOccurs="0"
ecore:reference="domain:User"
ecore:opposite="organizations">
</xsd:element>
<xsd:element name="departments" type="domain:Organization"
maxOccurs="unbounded" minOccurs="0"
ecore:reference="domain:Organization">
</xsd:element>
<xsd:element name="parentOrg" type="domain:Organization"
maxOccurs="1" minOccurs="0"
ecore:reference="domain:Organization">
</xsd:element>
</xsd:sequence>
....
</xsd:complexType>
This becomes a recursive structure, where
organisations can contain organisations
organisations can have many users
users can belong to many organisations
In teneo 0.8.0 all was good - when I switch to 1.0.2 my recursive
listings of organisations are incomplete. It works, but I do not get all
my organisations listed.
Clues:
When I start the app I get the following in my log
1 WARN org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper -
Indexed is true but indexed is not supported for inverse=true and
many-to-many, not setting inverse=true
2 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: alter
table `contentdescription_keywords` add index
contentdescription_keywords (`keyword_e_id`), add constraint
contentdescription_keywords foreign key (`keyword_e_id`) references
`keyword` (e_id)
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Can't create table
'.\canmicrosite\#sql-5a0_7b.frm' (errno: 121)
I think 2 is OK, as it an index that can not be created becuase it is
already there but I am suspicious about 1.
Looking at some of the other threads here and at elver.org there are
examples where annotations are used to make the many2many linking -
something like:
<xsd:element minOccurs="0" maxOccurs="unbounded" name="userRole"
type="xsd:anyURI" ecore:opposite="roleUser"
ecore:reference="this:Role">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa"> @ManyToMany(indexed=false)
@JoinTable(name="UserRole")
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
This suggests there is another/new way of making there relations in
Teneo 1.0.2, or maybe I have just been doing it wrong and the hole has
been mended.
Any help is appreciated.
Regards, Jesper Wermuth
|
|
|
Re: [Teneo] migrating from 0.8.0 to 1.0.2, Indexed is true but indexed is not supported for inverse= [message #426582 is a reply to message #426581] |
Wed, 14 January 2009 16:29 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Jesper,
To get some more info, can you get the mapping generated by Teneo in 0.8.0 and the one generated for
1.0.2? The mapping can be retrieved from the datastore by calling getMappingXML(). Then if you can
post both mappings then I can compare them.
gr. Martin
Jesper Wermuth wrote:
> Hi,
>
> I am (trying to) move the the latest teneo version in a running project.
> Project contains live data, so a clean start is not an option.
>
> The project involves several models, one of which contains users that
> belong to organisations. One user can belong to several organisations.
> Expressed in xsd this becomes:
>
> <xsd:complexType name="User">
> <xsd:sequence>
> ...
> <xsd:element name="organizations" type="domain:Organization"
> maxOccurs="unbounded" minOccurs="1"
> ecore:reference="domain:Organization" ecore:opposite="users">
> </xsd:element>
> </xsd:sequence>
> ....
> </xsd:complexType>
>
> <xsd:complexType name="Organization">
> <xsd:sequence>
> <xsd:element name="users" type="domain:User"
> maxOccurs="unbounded" minOccurs="0"
> ecore:reference="domain:User"
> ecore:opposite="organizations">
> </xsd:element>
> <xsd:element name="departments" type="domain:Organization"
> maxOccurs="unbounded" minOccurs="0"
> ecore:reference="domain:Organization">
> </xsd:element>
> <xsd:element name="parentOrg" type="domain:Organization"
> maxOccurs="1" minOccurs="0"
> ecore:reference="domain:Organization">
> </xsd:element>
> </xsd:sequence>
> ....
> </xsd:complexType>
>
> This becomes a recursive structure, where
> organisations can contain organisations
> organisations can have many users
> users can belong to many organisations
>
> In teneo 0.8.0 all was good - when I switch to 1.0.2 my recursive
> listings of organisations are incomplete. It works, but I do not get all
> my organisations listed.
> Clues:
> When I start the app I get the following in my log
> 1 WARN org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper -
> Indexed is true but indexed is not supported for inverse=true and
> many-to-many, not setting inverse=true
> 2 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: alter
> table `contentdescription_keywords` add index
> contentdescription_keywords (`keyword_e_id`), add constraint
> contentdescription_keywords foreign key (`keyword_e_id`) references
> `keyword` (e_id)
> ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Can't create table
> '.\canmicrosite\#sql-5a0_7b.frm' (errno: 121)
>
> I think 2 is OK, as it an index that can not be created becuase it is
> already there but I am suspicious about 1.
>
> Looking at some of the other threads here and at elver.org there are
> examples where annotations are used to make the many2many linking -
> something like:
>
> <xsd:element minOccurs="0" maxOccurs="unbounded" name="userRole"
> type="xsd:anyURI" ecore:opposite="roleUser"
> ecore:reference="this:Role">
> <xsd:annotation>
> <xsd:appinfo source="teneo.jpa"> @ManyToMany(indexed=false)
> @JoinTable(name="UserRole")
> </xsd:appinfo>
> </xsd:annotation>
> </xsd:element>
>
> This suggests there is another/new way of making there relations in
> Teneo 1.0.2, or maybe I have just been doing it wrong and the hole has
> been mended.
>
> Any help is appreciated.
> Regards, Jesper Wermuth
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [Teneo] migrating from 0.8.0 to 1.0.2, Indexed is true but indexed is not supported for inverse= [message #426642 is a reply to message #426582] |
Fri, 16 January 2009 09:16 |
Jesper Wermuth Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Did the compare :
In 0.8.0 the xmlmappings was:
<list name="departments" lazy="true">
<key update="true" foreign-key="organization_departments">
<column name="`organization_departments_e_id`" not-null="false"
unique="false"/>
</key>
<list-index column="`organization_departments_idx`"/>
<one-to-many entity-name="Organization"/>
</list>
in 1.0.2 the xmlmapping became:
<list name="departments" table="`organization_departments`" lazy="true">
<key update="true">
<column name="`organization_departments_e_id`" not-null="true"
unique="false"/>
</key>
<list-index column="`organization_departments_idx`"/>
<many-to-many entity-name="Organization" unique="true"
foreign-key="organization_departments">
<column name="`organization_e_id`" not-null="true" unique="false"/>
</many-to-many>
</list>
Thanks, Jesper
Martin Taal skrev:
> Hi Jesper,
> To get some more info, can you get the mapping generated by Teneo in
> 0.8.0 and the one generated for 1.0.2? The mapping can be retrieved from
> the datastore by calling getMappingXML(). Then if you can post both
> mappings then I can compare them.
>
> gr. Martin
>
> Jesper Wermuth wrote:
>> Hi,
>>
>> I am (trying to) move the the latest teneo version in a running
>> project. Project contains live data, so a clean start is not an option.
>>
>> The project involves several models, one of which contains users that
>> belong to organisations. One user can belong to several organisations.
>> Expressed in xsd this becomes:
>>
>> <xsd:complexType name="User">
>> <xsd:sequence>
>> ...
>> <xsd:element name="organizations" type="domain:Organization"
>> maxOccurs="unbounded" minOccurs="1"
>> ecore:reference="domain:Organization" ecore:opposite="users">
>> </xsd:element>
>> </xsd:sequence>
>> ....
>> </xsd:complexType>
>>
>> <xsd:complexType name="Organization">
>> <xsd:sequence>
>> <xsd:element name="users" type="domain:User"
>> maxOccurs="unbounded" minOccurs="0"
>> ecore:reference="domain:User"
>> ecore:opposite="organizations">
>> </xsd:element>
>> <xsd:element name="departments" type="domain:Organization"
>> maxOccurs="unbounded" minOccurs="0"
>> ecore:reference="domain:Organization">
>> </xsd:element>
>> <xsd:element name="parentOrg" type="domain:Organization"
>> maxOccurs="1" minOccurs="0"
>> ecore:reference="domain:Organization">
>> </xsd:element>
>> </xsd:sequence>
>> ....
>> </xsd:complexType>
>>
>> This becomes a recursive structure, where
>> organisations can contain organisations
>> organisations can have many users
>> users can belong to many organisations
>>
>> In teneo 0.8.0 all was good - when I switch to 1.0.2 my recursive
>> listings of organisations are incomplete. It works, but I do not get
>> all my organisations listed.
>> Clues:
>> When I start the app I get the following in my log
>> 1 WARN org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper -
>> Indexed is true but indexed is not supported for inverse=true and
>> many-to-many, not setting inverse=true
>> 2 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: alter
>> table `contentdescription_keywords` add index
>> contentdescription_keywords (`keyword_e_id`), add constraint
>> contentdescription_keywords foreign key (`keyword_e_id`) references
>> `keyword` (e_id)
>> ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Can't create table
>> '.\canmicrosite\#sql-5a0_7b.frm' (errno: 121)
>>
>> I think 2 is OK, as it an index that can not be created becuase it is
>> already there but I am suspicious about 1.
>>
>> Looking at some of the other threads here and at elver.org there are
>> examples where annotations are used to make the many2many linking -
>> something like:
>>
>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="userRole"
>> type="xsd:anyURI" ecore:opposite="roleUser"
>> ecore:reference="this:Role">
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa"> @ManyToMany(indexed=false)
>> @JoinTable(name="UserRole")
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:element>
>>
>> This suggests there is another/new way of making there relations in
>> Teneo 1.0.2, or maybe I have just been doing it wrong and the hole has
>> been mended.
>>
>> Any help is appreciated.
>> Regards, Jesper Wermuth
>
>
|
|
|
Re: [Teneo] migrating from 0.8.0 to 1.0.2, Indexed is true but indexed is not supported for inverse= [message #426646 is a reply to message #426642] |
Fri, 16 January 2009 11:07 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Jesper,
Hmmm, one thing that changed is that as a default for one-to-many associations (like departments)
now a join table is used. This is controlled by the option:
PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS
so if you set this to "false" then you will probably get another mapping. Can you try?
This also explains why you get strange results (incomplete lists), as there is no join table in your
database schema present.
gr. Martin
Jesper Wermuth wrote:
> Did the compare :
> In 0.8.0 the xmlmappings was:
>
> <list name="departments" lazy="true">
> <key update="true" foreign-key="organization_departments">
> <column name="`organization_departments_e_id`" not-null="false"
> unique="false"/>
> </key>
> <list-index column="`organization_departments_idx`"/>
> <one-to-many entity-name="Organization"/>
> </list>
>
> in 1.0.2 the xmlmapping became:
> <list name="departments" table="`organization_departments`" lazy="true">
> <key update="true">
> <column name="`organization_departments_e_id`" not-null="true"
> unique="false"/>
> </key>
> <list-index column="`organization_departments_idx`"/>
> <many-to-many entity-name="Organization" unique="true"
> foreign-key="organization_departments">
> <column name="`organization_e_id`" not-null="true" unique="false"/>
> </many-to-many>
> </list>
>
> Thanks, Jesper
>
> Martin Taal skrev:
>> Hi Jesper,
>> To get some more info, can you get the mapping generated by Teneo in
>> 0.8.0 and the one generated for 1.0.2? The mapping can be retrieved
>> from the datastore by calling getMappingXML(). Then if you can post
>> both mappings then I can compare them.
>>
>> gr. Martin
>>
>> Jesper Wermuth wrote:
>>> Hi,
>>>
>>> I am (trying to) move the the latest teneo version in a running
>>> project. Project contains live data, so a clean start is not an option.
>>>
>>> The project involves several models, one of which contains users that
>>> belong to organisations. One user can belong to several organisations.
>>> Expressed in xsd this becomes:
>>>
>>> <xsd:complexType name="User">
>>> <xsd:sequence>
>>> ...
>>> <xsd:element name="organizations" type="domain:Organization"
>>> maxOccurs="unbounded" minOccurs="1"
>>> ecore:reference="domain:Organization" ecore:opposite="users">
>>> </xsd:element>
>>> </xsd:sequence>
>>> ....
>>> </xsd:complexType>
>>>
>>> <xsd:complexType name="Organization">
>>> <xsd:sequence>
>>> <xsd:element name="users" type="domain:User"
>>> maxOccurs="unbounded" minOccurs="0"
>>> ecore:reference="domain:User"
>>> ecore:opposite="organizations">
>>> </xsd:element>
>>> <xsd:element name="departments" type="domain:Organization"
>>> maxOccurs="unbounded" minOccurs="0"
>>> ecore:reference="domain:Organization">
>>> </xsd:element>
>>> <xsd:element name="parentOrg" type="domain:Organization"
>>> maxOccurs="1" minOccurs="0"
>>> ecore:reference="domain:Organization">
>>> </xsd:element>
>>> </xsd:sequence>
>>> ....
>>> </xsd:complexType>
>>>
>>> This becomes a recursive structure, where
>>> organisations can contain organisations
>>> organisations can have many users
>>> users can belong to many organisations
>>>
>>> In teneo 0.8.0 all was good - when I switch to 1.0.2 my recursive
>>> listings of organisations are incomplete. It works, but I do not get
>>> all my organisations listed.
>>> Clues:
>>> When I start the app I get the following in my log
>>> 1 WARN org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper -
>>> Indexed is true but indexed is not supported for inverse=true and
>>> many-to-many, not setting inverse=true
>>> 2 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: alter
>>> table `contentdescription_keywords` add index
>>> contentdescription_keywords (`keyword_e_id`), add constraint
>>> contentdescription_keywords foreign key (`keyword_e_id`) references
>>> `keyword` (e_id)
>>> ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Can't create table
>>> '.\canmicrosite\#sql-5a0_7b.frm' (errno: 121)
>>>
>>> I think 2 is OK, as it an index that can not be created becuase it is
>>> already there but I am suspicious about 1.
>>>
>>> Looking at some of the other threads here and at elver.org there are
>>> examples where annotations are used to make the many2many linking -
>>> something like:
>>>
>>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="userRole"
>>> type="xsd:anyURI" ecore:opposite="roleUser"
>>> ecore:reference="this:Role">
>>> <xsd:annotation>
>>> <xsd:appinfo source="teneo.jpa"> @ManyToMany(indexed=false)
>>> @JoinTable(name="UserRole")
>>> </xsd:appinfo>
>>> </xsd:annotation>
>>> </xsd:element>
>>>
>>> This suggests there is another/new way of making there relations in
>>> Teneo 1.0.2, or maybe I have just been doing it wrong and the hole
>>> has been mended.
>>>
>>> Any help is appreciated.
>>> Regards, Jesper Wermuth
>>
>>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [Teneo] migrating from 0.8.0 to 1.0.2, Indexed is true but indexed is not supported for inverse= [message #426650 is a reply to message #426646] |
Fri, 16 January 2009 12:10 |
Jesper Wermuth Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Tried. I still get the many-to-many in mappingxml
Martin Taal skrev:
> Hi Jesper,
> Hmmm, one thing that changed is that as a default for one-to-many
> associations (like departments) now a join table is used. This is
> controlled by the option:
> PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS
>
> so if you set this to "false" then you will probably get another
> mapping. Can you try?
>
> This also explains why you get strange results (incomplete lists), as
> there is no join table in your database schema present.
>
> gr. Martin
>
> Jesper Wermuth wrote:
>> Did the compare :
>> In 0.8.0 the xmlmappings was:
>>
>> <list name="departments" lazy="true">
>> <key update="true" foreign-key="organization_departments">
>> <column name="`organization_departments_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <list-index column="`organization_departments_idx`"/>
>> <one-to-many entity-name="Organization"/>
>> </list>
>>
>> in 1.0.2 the xmlmapping became:
>> <list name="departments" table="`organization_departments`" lazy="true">
>> <key update="true">
>> <column name="`organization_departments_e_id`" not-null="true"
>> unique="false"/>
>> </key>
>> <list-index column="`organization_departments_idx`"/>
>> <many-to-many entity-name="Organization" unique="true"
>> foreign-key="organization_departments">
>> <column name="`organization_e_id`" not-null="true" unique="false"/>
>> </many-to-many>
>> </list>
>>
>> Thanks, Jesper
>>
>> Martin Taal skrev:
>>> Hi Jesper,
>>> To get some more info, can you get the mapping generated by Teneo in
>>> 0.8.0 and the one generated for 1.0.2? The mapping can be retrieved
>>> from the datastore by calling getMappingXML(). Then if you can post
>>> both mappings then I can compare them.
>>>
>>> gr. Martin
>>>
>>> Jesper Wermuth wrote:
>>>> Hi,
>>>>
>>>> I am (trying to) move the the latest teneo version in a running
>>>> project. Project contains live data, so a clean start is not an
>>>> option.
>>>>
>>>> The project involves several models, one of which contains users
>>>> that belong to organisations. One user can belong to several
>>>> organisations.
>>>> Expressed in xsd this becomes:
>>>>
>>>> <xsd:complexType name="User">
>>>> <xsd:sequence>
>>>> ...
>>>> <xsd:element name="organizations" type="domain:Organization"
>>>> maxOccurs="unbounded" minOccurs="1"
>>>> ecore:reference="domain:Organization" ecore:opposite="users">
>>>> </xsd:element>
>>>> </xsd:sequence>
>>>> ....
>>>> </xsd:complexType>
>>>>
>>>> <xsd:complexType name="Organization">
>>>> <xsd:sequence>
>>>> <xsd:element name="users" type="domain:User"
>>>> maxOccurs="unbounded" minOccurs="0"
>>>> ecore:reference="domain:User"
>>>> ecore:opposite="organizations">
>>>> </xsd:element>
>>>> <xsd:element name="departments" type="domain:Organization"
>>>> maxOccurs="unbounded" minOccurs="0"
>>>> ecore:reference="domain:Organization">
>>>> </xsd:element>
>>>> <xsd:element name="parentOrg" type="domain:Organization"
>>>> maxOccurs="1" minOccurs="0"
>>>> ecore:reference="domain:Organization">
>>>> </xsd:element>
>>>> </xsd:sequence>
>>>> ....
>>>> </xsd:complexType>
>>>>
>>>> This becomes a recursive structure, where
>>>> organisations can contain organisations
>>>> organisations can have many users
>>>> users can belong to many organisations
>>>>
>>>> In teneo 0.8.0 all was good - when I switch to 1.0.2 my recursive
>>>> listings of organisations are incomplete. It works, but I do not get
>>>> all my organisations listed.
>>>> Clues:
>>>> When I start the app I get the following in my log
>>>> 1 WARN org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper -
>>>> Indexed is true but indexed is not supported for inverse=true and
>>>> many-to-many, not setting inverse=true
>>>> 2 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: alter
>>>> table `contentdescription_keywords` add index
>>>> contentdescription_keywords (`keyword_e_id`), add constraint
>>>> contentdescription_keywords foreign key (`keyword_e_id`) references
>>>> `keyword` (e_id)
>>>> ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Can't create table
>>>> '.\canmicrosite\#sql-5a0_7b.frm' (errno: 121)
>>>>
>>>> I think 2 is OK, as it an index that can not be created becuase it
>>>> is already there but I am suspicious about 1.
>>>>
>>>> Looking at some of the other threads here and at elver.org there are
>>>> examples where annotations are used to make the many2many linking -
>>>> something like:
>>>>
>>>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="userRole"
>>>> type="xsd:anyURI" ecore:opposite="roleUser"
>>>> ecore:reference="this:Role">
>>>> <xsd:annotation>
>>>> <xsd:appinfo source="teneo.jpa"> @ManyToMany(indexed=false)
>>>> @JoinTable(name="UserRole")
>>>> </xsd:appinfo>
>>>> </xsd:annotation>
>>>> </xsd:element>
>>>>
>>>> This suggests there is another/new way of making there relations in
>>>> Teneo 1.0.2, or maybe I have just been doing it wrong and the hole
>>>> has been mended.
>>>>
>>>> Any help is appreciated.
>>>> Regards, Jesper Wermuth
>>>
>>>
>
>
|
|
|
Re: [Teneo] migrating from 0.8.0 to 1.0.2, Indexed is true but indexed is not supported for inverse= [message #426653 is a reply to message #426650] |
Fri, 16 January 2009 12:25 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Jesper,
Hmm, maybe my mistake, is this a containment relation? The xsd contains both
type="domain:Organization" as well as ecore:reference="domain:Organization". If it is containment
then the option won't make a difference, but it is strange that with containment a join table is
selected.
Does the departments feature have an eopposite when you look in the ecore model?
Can you debug into the code, you have to put a breakpoint in this method and then test why it
chooses to add a jointable:
OneToManyReferenceAnnotator.annotate(...)
or in
BidirectionalManyToManyAnnotator.annotate(...)
if the departments feature has an opposite in ecore.
gr. Martin
Jesper Wermuth wrote:
> Tried. I still get the many-to-many in mappingxml
>
> Martin Taal skrev:
>> Hi Jesper,
>> Hmmm, one thing that changed is that as a default for one-to-many
>> associations (like departments) now a join table is used. This is
>> controlled by the option:
>> PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS
>>
>> so if you set this to "false" then you will probably get another
>> mapping. Can you try?
>>
>> This also explains why you get strange results (incomplete lists), as
>> there is no join table in your database schema present.
>>
>> gr. Martin
>>
>> Jesper Wermuth wrote:
>>> Did the compare :
>>> In 0.8.0 the xmlmappings was:
>>>
>>> <list name="departments" lazy="true">
>>> <key update="true" foreign-key="organization_departments">
>>> <column name="`organization_departments_e_id`" not-null="false"
>>> unique="false"/>
>>> </key>
>>> <list-index column="`organization_departments_idx`"/>
>>> <one-to-many entity-name="Organization"/>
>>> </list>
>>>
>>> in 1.0.2 the xmlmapping became:
>>> <list name="departments" table="`organization_departments`" lazy="true">
>>> <key update="true">
>>> <column name="`organization_departments_e_id`" not-null="true"
>>> unique="false"/>
>>> </key>
>>> <list-index column="`organization_departments_idx`"/>
>>> <many-to-many entity-name="Organization" unique="true"
>>> foreign-key="organization_departments">
>>> <column name="`organization_e_id`" not-null="true" unique="false"/>
>>> </many-to-many>
>>> </list>
>>>
>>> Thanks, Jesper
>>>
>>> Martin Taal skrev:
>>>> Hi Jesper,
>>>> To get some more info, can you get the mapping generated by Teneo in
>>>> 0.8.0 and the one generated for 1.0.2? The mapping can be retrieved
>>>> from the datastore by calling getMappingXML(). Then if you can post
>>>> both mappings then I can compare them.
>>>>
>>>> gr. Martin
>>>>
>>>> Jesper Wermuth wrote:
>>>>> Hi,
>>>>>
>>>>> I am (trying to) move the the latest teneo version in a running
>>>>> project. Project contains live data, so a clean start is not an
>>>>> option.
>>>>>
>>>>> The project involves several models, one of which contains users
>>>>> that belong to organisations. One user can belong to several
>>>>> organisations.
>>>>> Expressed in xsd this becomes:
>>>>>
>>>>> <xsd:complexType name="User">
>>>>> <xsd:sequence>
>>>>> ...
>>>>> <xsd:element name="organizations" type="domain:Organization"
>>>>> maxOccurs="unbounded" minOccurs="1"
>>>>> ecore:reference="domain:Organization" ecore:opposite="users">
>>>>> </xsd:element>
>>>>> </xsd:sequence>
>>>>> ....
>>>>> </xsd:complexType>
>>>>>
>>>>> <xsd:complexType name="Organization">
>>>>> <xsd:sequence>
>>>>> <xsd:element name="users" type="domain:User"
>>>>> maxOccurs="unbounded" minOccurs="0"
>>>>> ecore:reference="domain:User"
>>>>> ecore:opposite="organizations">
>>>>> </xsd:element>
>>>>> <xsd:element name="departments" type="domain:Organization"
>>>>> maxOccurs="unbounded" minOccurs="0"
>>>>> ecore:reference="domain:Organization">
>>>>> </xsd:element>
>>>>> <xsd:element name="parentOrg" type="domain:Organization"
>>>>> maxOccurs="1" minOccurs="0"
>>>>> ecore:reference="domain:Organization">
>>>>> </xsd:element>
>>>>> </xsd:sequence>
>>>>> ....
>>>>> </xsd:complexType>
>>>>>
>>>>> This becomes a recursive structure, where
>>>>> organisations can contain organisations
>>>>> organisations can have many users
>>>>> users can belong to many organisations
>>>>>
>>>>> In teneo 0.8.0 all was good - when I switch to 1.0.2 my recursive
>>>>> listings of organisations are incomplete. It works, but I do not
>>>>> get all my organisations listed.
>>>>> Clues:
>>>>> When I start the app I get the following in my log
>>>>> 1 WARN org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper -
>>>>> Indexed is true but indexed is not supported for inverse=true and
>>>>> many-to-many, not setting inverse=true
>>>>> 2 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: alter
>>>>> table `contentdescription_keywords` add index
>>>>> contentdescription_keywords (`keyword_e_id`), add constraint
>>>>> contentdescription_keywords foreign key (`keyword_e_id`) references
>>>>> `keyword` (e_id)
>>>>> ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Can't create table
>>>>> '.\canmicrosite\#sql-5a0_7b.frm' (errno: 121)
>>>>>
>>>>> I think 2 is OK, as it an index that can not be created becuase it
>>>>> is already there but I am suspicious about 1.
>>>>>
>>>>> Looking at some of the other threads here and at elver.org there
>>>>> are examples where annotations are used to make the many2many
>>>>> linking - something like:
>>>>>
>>>>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="userRole"
>>>>> type="xsd:anyURI" ecore:opposite="roleUser"
>>>>> ecore:reference="this:Role">
>>>>> <xsd:annotation>
>>>>> <xsd:appinfo source="teneo.jpa"> @ManyToMany(indexed=false)
>>>>> @JoinTable(name="UserRole")
>>>>> </xsd:appinfo>
>>>>> </xsd:annotation>
>>>>> </xsd:element>
>>>>>
>>>>> This suggests there is another/new way of making there relations in
>>>>> Teneo 1.0.2, or maybe I have just been doing it wrong and the hole
>>>>> has been mended.
>>>>>
>>>>> Any help is appreciated.
>>>>> Regards, Jesper Wermuth
>>>>
>>>>
>>
>>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [Teneo] migrating from 0.8.0 to 1.0.2, Indexed is true but indexed is not supported for inverse= [message #426655 is a reply to message #426653] |
Fri, 16 January 2009 13:10 |
Jesper Wermuth Messages: 6 Registered: July 2009 |
Junior Member |
|
|
The department is not a containment relation (when looking at the
generated code)
The department feature does not have EOpposite when looking at the ecore
model.
Debugging will take some time ...
Martin Taal skrev:
> Hi Jesper,
> Hmm, maybe my mistake, is this a containment relation? The xsd contains
> both type="domain:Organization" as well as
> ecore:reference="domain:Organization". If it is containment then the
> option won't make a difference, but it is strange that with containment
> a join table is selected.
> Does the departments feature have an eopposite when you look in the
> ecore model?
>
> Can you debug into the code, you have to put a breakpoint in this method
> and then test why it chooses to add a jointable:
> OneToManyReferenceAnnotator.annotate(...)
>
> or in
> BidirectionalManyToManyAnnotator.annotate(...)
> if the departments feature has an opposite in ecore.
>
> gr. Martin
>
> Jesper Wermuth wrote:
>> Tried. I still get the many-to-many in mappingxml
>>
>> Martin Taal skrev:
>>> Hi Jesper,
>>> Hmmm, one thing that changed is that as a default for one-to-many
>>> associations (like departments) now a join table is used. This is
>>> controlled by the option:
>>> PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS
>>>
>>> so if you set this to "false" then you will probably get another
>>> mapping. Can you try?
>>>
>>> This also explains why you get strange results (incomplete lists), as
>>> there is no join table in your database schema present.
>>>
>>> gr. Martin
>>>
>>> Jesper Wermuth wrote:
>>>> Did the compare :
>>>> In 0.8.0 the xmlmappings was:
>>>>
>>>> <list name="departments" lazy="true">
>>>> <key update="true" foreign-key="organization_departments">
>>>> <column name="`organization_departments_e_id`" not-null="false"
>>>> unique="false"/>
>>>> </key>
>>>> <list-index column="`organization_departments_idx`"/>
>>>> <one-to-many entity-name="Organization"/>
>>>> </list>
>>>>
>>>> in 1.0.2 the xmlmapping became:
>>>> <list name="departments" table="`organization_departments`"
>>>> lazy="true">
>>>> <key update="true">
>>>> <column name="`organization_departments_e_id`" not-null="true"
>>>> unique="false"/>
>>>> </key>
>>>> <list-index column="`organization_departments_idx`"/>
>>>> <many-to-many entity-name="Organization" unique="true"
>>>> foreign-key="organization_departments">
>>>> <column name="`organization_e_id`" not-null="true" unique="false"/>
>>>> </many-to-many>
>>>> </list>
>>>>
>>>> Thanks, Jesper
>>>>
>>>> Martin Taal skrev:
>>>>> Hi Jesper,
>>>>> To get some more info, can you get the mapping generated by Teneo
>>>>> in 0.8.0 and the one generated for 1.0.2? The mapping can be
>>>>> retrieved from the datastore by calling getMappingXML(). Then if
>>>>> you can post both mappings then I can compare them.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Jesper Wermuth wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I am (trying to) move the the latest teneo version in a running
>>>>>> project. Project contains live data, so a clean start is not an
>>>>>> option.
>>>>>>
>>>>>> The project involves several models, one of which contains users
>>>>>> that belong to organisations. One user can belong to several
>>>>>> organisations.
>>>>>> Expressed in xsd this becomes:
>>>>>>
>>>>>> <xsd:complexType name="User">
>>>>>> <xsd:sequence>
>>>>>> ...
>>>>>> <xsd:element name="organizations" type="domain:Organization"
>>>>>> maxOccurs="unbounded" minOccurs="1"
>>>>>> ecore:reference="domain:Organization" ecore:opposite="users">
>>>>>> </xsd:element>
>>>>>> </xsd:sequence>
>>>>>> ....
>>>>>> </xsd:complexType>
>>>>>>
>>>>>> <xsd:complexType name="Organization">
>>>>>> <xsd:sequence>
>>>>>> <xsd:element name="users" type="domain:User"
>>>>>> maxOccurs="unbounded" minOccurs="0"
>>>>>> ecore:reference="domain:User"
>>>>>> ecore:opposite="organizations">
>>>>>> </xsd:element>
>>>>>> <xsd:element name="departments" type="domain:Organization"
>>>>>> maxOccurs="unbounded" minOccurs="0"
>>>>>> ecore:reference="domain:Organization">
>>>>>> </xsd:element>
>>>>>> <xsd:element name="parentOrg" type="domain:Organization"
>>>>>> maxOccurs="1" minOccurs="0"
>>>>>> ecore:reference="domain:Organization">
>>>>>> </xsd:element>
>>>>>> </xsd:sequence>
>>>>>> ....
>>>>>> </xsd:complexType>
>>>>>>
>>>>>> This becomes a recursive structure, where
>>>>>> organisations can contain organisations
>>>>>> organisations can have many users
>>>>>> users can belong to many organisations
>>>>>>
>>>>>> In teneo 0.8.0 all was good - when I switch to 1.0.2 my recursive
>>>>>> listings of organisations are incomplete. It works, but I do not
>>>>>> get all my organisations listed.
>>>>>> Clues:
>>>>>> When I start the app I get the following in my log
>>>>>> 1 WARN org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper -
>>>>>> Indexed is true but indexed is not supported for inverse=true and
>>>>>> many-to-many, not setting inverse=true
>>>>>> 2 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful:
>>>>>> alter
>>>>>> table `contentdescription_keywords` add index
>>>>>> contentdescription_keywords (`keyword_e_id`), add constraint
>>>>>> contentdescription_keywords foreign key (`keyword_e_id`)
>>>>>> references
>>>>>> `keyword` (e_id)
>>>>>> ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Can't create table
>>>>>> '.\canmicrosite\#sql-5a0_7b.frm' (errno: 121)
>>>>>>
>>>>>> I think 2 is OK, as it an index that can not be created becuase it
>>>>>> is already there but I am suspicious about 1.
>>>>>>
>>>>>> Looking at some of the other threads here and at elver.org there
>>>>>> are examples where annotations are used to make the many2many
>>>>>> linking - something like:
>>>>>>
>>>>>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="userRole"
>>>>>> type="xsd:anyURI" ecore:opposite="roleUser"
>>>>>> ecore:reference="this:Role">
>>>>>> <xsd:annotation>
>>>>>> <xsd:appinfo source="teneo.jpa"> @ManyToMany(indexed=false)
>>>>>> @JoinTable(name="UserRole")
>>>>>> </xsd:appinfo>
>>>>>> </xsd:annotation>
>>>>>> </xsd:element>
>>>>>>
>>>>>> This suggests there is another/new way of making there relations
>>>>>> in Teneo 1.0.2, or maybe I have just been doing it wrong and the
>>>>>> hole has been mended.
>>>>>>
>>>>>> Any help is appreciated.
>>>>>> Regards, Jesper Wermuth
>>>>>
>>>>>
>>>
>>>
>
>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 21:46:12 GMT 2024
Powered by FUDForum. Page generated in 0.02793 seconds
|