Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Same named element in 2 different xsd
Same named element in 2 different xsd [message #82580] Tue, 08 May 2007 14:35 Go to next message
Julia is currently offline JuliaFriend
Messages: 85
Registered: July 2009
Member
Hi Martin,

I have the same named element "ParentTree" in 2 different xsds eg
navigation.xsd and topology.xsd. Navigation.xsd reference topology.xsd. So
when I try a datastore.initialize, teneo finds the same eClass in
"ParentTree" in navigation and topology. Is there a way around this? Can I
redirect one of the ParentTree to point to a different table in the
database without explicitly changing the xsd?

Julia
Re: Same named element in 2 different xsd [message #82628 is a reply to message #82580] Tue, 08 May 2007 18:39 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Julia,
If the problem is that both eclasses are stored in the same table then you can use an
@Table(name="myname") annotation on the eclass to control were it is stored. You can set this
annotation in the xsd, the ecore or in a separate xml file.

See here for some extra info:
http://www.elver.org/jpox/ejb3_features.html
http://www.elver.org/jpox/ejb3_format.html
http://www.elver.org/jpox/ejb3_examples.html

gr. Martin

Julia wrote:
> Hi Martin,
>
> I have the same named element "ParentTree" in 2 different xsds eg
> navigation.xsd and topology.xsd. Navigation.xsd reference topology.xsd.
> So when I try a datastore.initialize, teneo finds the same eClass in
> "ParentTree" in navigation and topology. Is there a way around this? Can
> I redirect one of the ParentTree to point to a different table in the
> database without explicitly changing the xsd?
>
> Julia
>


--

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: Same named element in 2 different xsd [message #82639 is a reply to message #82628] Tue, 08 May 2007 21:34 Go to previous messageGo to next message
Julia is currently offline JuliaFriend
Messages: 85
Registered: July 2009
Member
Hi Martin,

Actually, it's the same named element and structure in both xsds but will
hold different data. Would I not need 2 different tables in the datastore?
Would changing the table="ParentTree" to table="ParentTree_nav" in
package.jdo for one of the xsds work? It's probably a hack :-). Would
following the links you provided work in this case?

Julia
Re: Same named element in 2 different xsd [message #82649 is a reply to message #82639] Wed, 09 May 2007 05:03 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Julia,
I would assume that they are conceptually different (as they are modelled each as their own type).
So in this case they would need different tables.

To solve the duplicate eclass name issue (when generating the jdo file) the best is to set the
following property
PersistenceOptions.QUALIFY_ENTITY_NAME
to
PersistenceOptions.QUALIFY_ENTITY_NAME_NSPREFIX);

This property must be set to generate the jdo file. However passing properties can not be done for
the right-click menu-generate-jdo option. You have to generate the jdo file programmatically. This
is not difficult, just make a class with a static main method in your model project and call the
following method:
JpoxHelper.INSTANCE.generateMapping(your_epackages, options)

this will return the jdo file.

gr. Martin

Julia wrote:
> Hi Martin,
>
> Actually, it's the same named element and structure in both xsds but
> will hold different data. Would I not need 2 different tables in the
> datastore? Would changing the table="ParentTree" to
> table="ParentTree_nav" in package.jdo for one of the xsds work? It's
> probably a hack :-). Would following the links you provided work in this
> case?
>
> Julia
>


--

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: Same named element in 2 different xsd [message #82700 is a reply to message #82649] Wed, 09 May 2007 12:17 Go to previous message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi Martin,

May be at some stage teneo can implement some extension point so that
one can set these options in Window -> Preferences... for teneo.

Regards,
Parvez

Martin Taal wrote:
> Hi Julia,
> I would assume that they are conceptually different (as they are
> modelled each as their own type).
> So in this case they would need different tables.
>
> To solve the duplicate eclass name issue (when generating the jdo file)
> the best is to set the following property
> PersistenceOptions.QUALIFY_ENTITY_NAME
> to
> PersistenceOptions.QUALIFY_ENTITY_NAME_NSPREFIX);
>
> This property must be set to generate the jdo file. However passing
> properties can not be done for the right-click menu-generate-jdo option.
> You have to generate the jdo file programmatically. This is not
> difficult, just make a class with a static main method in your model
> project and call the following method:
> JpoxHelper.INSTANCE.generateMapping(your_epackages, options)
>
> this will return the jdo file.
>
> gr. Martin
>
> Julia wrote:
>> Hi Martin,
>>
>> Actually, it's the same named element and structure in both xsds but
>> will hold different data. Would I not need 2 different tables in the
>> datastore? Would changing the table="ParentTree" to
>> table="ParentTree_nav" in package.jdo for one of the xsds work? It's
>> probably a hack :-). Would following the links you provided work in
>> this case?
>>
>> Julia
>>
>
>
Re: Same named element in 2 different xsd [message #606632 is a reply to message #82580] Tue, 08 May 2007 18:39 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Julia,
If the problem is that both eclasses are stored in the same table then you can use an
@Table(name="myname") annotation on the eclass to control were it is stored. You can set this
annotation in the xsd, the ecore or in a separate xml file.

See here for some extra info:
http://www.elver.org/jpox/ejb3_features.html
http://www.elver.org/jpox/ejb3_format.html
http://www.elver.org/jpox/ejb3_examples.html

gr. Martin

Julia wrote:
> Hi Martin,
>
> I have the same named element "ParentTree" in 2 different xsds eg
> navigation.xsd and topology.xsd. Navigation.xsd reference topology.xsd.
> So when I try a datastore.initialize, teneo finds the same eClass in
> "ParentTree" in navigation and topology. Is there a way around this? Can
> I redirect one of the ParentTree to point to a different table in the
> database without explicitly changing the xsd?
>
> Julia
>


--

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: Same named element in 2 different xsd [message #606633 is a reply to message #82628] Tue, 08 May 2007 21:34 Go to previous message
Julia is currently offline JuliaFriend
Messages: 85
Registered: July 2009
Member
Hi Martin,

Actually, it's the same named element and structure in both xsds but will
hold different data. Would I not need 2 different tables in the datastore?
Would changing the table="ParentTree" to table="ParentTree_nav" in
package.jdo for one of the xsds work? It's probably a hack :-). Would
following the links you provided work in this case?

Julia
Re: Same named element in 2 different xsd [message #606634 is a reply to message #82639] Wed, 09 May 2007 05:03 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Julia,
I would assume that they are conceptually different (as they are modelled each as their own type).
So in this case they would need different tables.

To solve the duplicate eclass name issue (when generating the jdo file) the best is to set the
following property
PersistenceOptions.QUALIFY_ENTITY_NAME
to
PersistenceOptions.QUALIFY_ENTITY_NAME_NSPREFIX);

This property must be set to generate the jdo file. However passing properties can not be done for
the right-click menu-generate-jdo option. You have to generate the jdo file programmatically. This
is not difficult, just make a class with a static main method in your model project and call the
following method:
JpoxHelper.INSTANCE.generateMapping(your_epackages, options)

this will return the jdo file.

gr. Martin

Julia wrote:
> Hi Martin,
>
> Actually, it's the same named element and structure in both xsds but
> will hold different data. Would I not need 2 different tables in the
> datastore? Would changing the table="ParentTree" to
> table="ParentTree_nav" in package.jdo for one of the xsds work? It's
> probably a hack :-). Would following the links you provided work in this
> case?
>
> Julia
>


--

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: Same named element in 2 different xsd [message #606639 is a reply to message #82649] Wed, 09 May 2007 12:17 Go to previous message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi Martin,

May be at some stage teneo can implement some extension point so that
one can set these options in Window -> Preferences... for teneo.

Regards,
Parvez

Martin Taal wrote:
> Hi Julia,
> I would assume that they are conceptually different (as they are
> modelled each as their own type).
> So in this case they would need different tables.
>
> To solve the duplicate eclass name issue (when generating the jdo file)
> the best is to set the following property
> PersistenceOptions.QUALIFY_ENTITY_NAME
> to
> PersistenceOptions.QUALIFY_ENTITY_NAME_NSPREFIX);
>
> This property must be set to generate the jdo file. However passing
> properties can not be done for the right-click menu-generate-jdo option.
> You have to generate the jdo file programmatically. This is not
> difficult, just make a class with a static main method in your model
> project and call the following method:
> JpoxHelper.INSTANCE.generateMapping(your_epackages, options)
>
> this will return the jdo file.
>
> gr. Martin
>
> Julia wrote:
>> Hi Martin,
>>
>> Actually, it's the same named element and structure in both xsds but
>> will hold different data. Would I not need 2 different tables in the
>> datastore? Would changing the table="ParentTree" to
>> table="ParentTree_nav" in package.jdo for one of the xsds work? It's
>> probably a hack :-). Would following the links you provided work in
>> this case?
>>
>> Julia
>>
>
>
Previous Topic:Restrict copy/paste for some elemets
Next Topic:HbDataStore.close() throwing SQLException
Goto Forum:
  


Current Time: Fri Apr 26 21:44:25 GMT 2024

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

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

Back to the top