Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XSD ID -> EMF ID -> hibernate id
XSD ID -> EMF ID -> hibernate id [message #423612] Thu, 02 October 2008 23:58 Go to next message
Andrew H is currently offline Andrew HFriend
Messages: 117
Registered: July 2009
Senior Member
As discussed in
http://www.eclipse.org/newsportal/article.php?id=36086&g roup=eclipse.tools.emf#36086

I started with some XSD's, generated EMF models and then persisted with
Teneo. Fields that were declared in XSD as ID fields went into EMF as ID
fields and then as id elements in the hibernate mappings. i.e. these
fields became primary key fields.

However, the XSD authors never intended them to be globally unique, just
unique within a single document. They use IDREF fields elsewhere in the
doc to refer to them.

Consequently they are not suitable as id fields in the hibernate mappings.

I fixed this with Martin's help by turning off the mapping from EMF ID to
hibernate id.

However, its not clear to me whether this was the best place to fix it. Is
the semantics of ID in EMF that the field is intended to be a unique
primary key for that class?

If so then I should probably sever the mapping of XSD ID to EMF ID for
these fields instead? If so how do I do that?

Thoughts?
Re: XSD ID -> EMF ID -> hibernate id [message #423613 is a reply to message #423612] Fri, 03 October 2008 00:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Andrew,

EMF's EObject IDs are intended to be resource-unique, as in XSD. The
UUID utility is a convenience for generating IDs that probably are
universally unique, but nothing in EMF expects this property.

HTH,

Christian

Andrew H wrote:
> As discussed in
> http://www.eclipse.org/newsportal/article.php?id=36086&g roup=eclipse.tools.emf#36086
>
>
> I started with some XSD's, generated EMF models and then persisted with
> Teneo. Fields that were declared in XSD as ID fields went into EMF as ID
> fields and then as id elements in the hibernate mappings. i.e. these
> fields became primary key fields.
>
> However, the XSD authors never intended them to be globally unique, just
> unique within a single document. They use IDREF fields elsewhere in the
> doc to refer to them.
>
> Consequently they are not suitable as id fields in the hibernate mappings.
>
> I fixed this with Martin's help by turning off the mapping from EMF ID
> to hibernate id.
>
> However, its not clear to me whether this was the best place to fix it.
> Is the semantics of ID in EMF that the field is intended to be a unique
> primary key for that class?
>
> If so then I should probably sever the mapping of XSD ID to EMF ID for
> these fields instead? If so how do I do that?
>
> Thoughts?
>
>
>
Re: XSD ID -> EMF ID -> hibernate id [message #423648 is a reply to message #423613] Sat, 04 October 2008 01:08 Go to previous messageGo to next message
Andrew H is currently offline Andrew HFriend
Messages: 117
Registered: July 2009
Senior Member
Thanks Christian

So I guess it comes down to what a resource is. In some cases it might
be a document, in others a table in a DB.

Christian W. Damus wrote:
> Hi, Andrew,
>
> EMF's EObject IDs are intended to be resource-unique, as in XSD. The
> UUID utility is a convenience for generating IDs that probably are
> universally unique, but nothing in EMF expects this property.
>
> HTH,
>
> Christian
>
> Andrew H wrote:
>> As discussed in
>> http://www.eclipse.org/newsportal/article.php?id=36086&g roup=eclipse.tools.emf#36086
>>
>>
>> I started with some XSD's, generated EMF models and then persisted
>> with Teneo. Fields that were declared in XSD as ID fields went into
>> EMF as ID fields and then as id elements in the hibernate mappings.
>> i.e. these fields became primary key fields.
>>
>> However, the XSD authors never intended them to be globally unique,
>> just unique within a single document. They use IDREF fields elsewhere
>> in the doc to refer to them.
>>
>> Consequently they are not suitable as id fields in the hibernate
>> mappings.
>>
>> I fixed this with Martin's help by turning off the mapping from EMF ID
>> to hibernate id.
>>
>> However, its not clear to me whether this was the best place to fix
>> it. Is the semantics of ID in EMF that the field is intended to be a
>> unique primary key for that class?
>>
>> If so then I should probably sever the mapping of XSD ID to EMF ID for
>> these fields instead? If so how do I do that?
>>
>> Thoughts?
>>
>>
>>
Re: XSD ID -> EMF ID -> hibernate id [message #423650 is a reply to message #423648] Sat, 04 October 2008 09:34 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Andres,
Or the resource represents the whole database, with Teneo a resource is connected to the database as
a whole, i.e. a Teneo EMF resource uses a hibernate session and with queries you can load data from
all the tables into the resource.

gr. Martin

andrew987650000@yahoo.com.au wrote:
> Thanks Christian
>
> So I guess it comes down to what a resource is. In some cases it might
> be a document, in others a table in a DB.
>
> Christian W. Damus wrote:
>> Hi, Andrew,
>>
>> EMF's EObject IDs are intended to be resource-unique, as in XSD. The
>> UUID utility is a convenience for generating IDs that probably are
>> universally unique, but nothing in EMF expects this property.
>>
>> HTH,
>>
>> Christian
>>
>> Andrew H wrote:
>>> As discussed in
>>> http://www.eclipse.org/newsportal/article.php?id=36086&g roup=eclipse.tools.emf#36086
>>>
>>>
>>> I started with some XSD's, generated EMF models and then persisted
>>> with Teneo. Fields that were declared in XSD as ID fields went into
>>> EMF as ID fields and then as id elements in the hibernate mappings.
>>> i.e. these fields became primary key fields.
>>>
>>> However, the XSD authors never intended them to be globally unique,
>>> just unique within a single document. They use IDREF fields elsewhere
>>> in the doc to refer to them.
>>>
>>> Consequently they are not suitable as id fields in the hibernate
>>> mappings.
>>>
>>> I fixed this with Martin's help by turning off the mapping from EMF
>>> ID to hibernate id.
>>>
>>> However, its not clear to me whether this was the best place to fix
>>> it. Is the semantics of ID in EMF that the field is intended to be a
>>> unique primary key for that class?
>>>
>>> If so then I should probably sever the mapping of XSD ID to EMF ID
>>> for these fields instead? If so how do I do that?
>>>
>>> Thoughts?
>>>
>>>
>>>


--

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: XSD ID -> EMF ID -> hibernate id [message #423651 is a reply to message #423650] Sat, 04 October 2008 09:36 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
And here with the correct spelling of your name, sorry (the s and w are too close to eachother for
my fingers apparently :-)

Hi Andrew,
Or the resource represents the whole database, with Teneo a resource is
connected to the database as a whole, i.e. a Teneo EMF resource uses a
hibernate session and with queries you can load data from all the tables
into the resource.

gr. Martin

Martin Taal wrote:
>
> andrew987650000@yahoo.com.au wrote:
>> Thanks Christian
>>
>> So I guess it comes down to what a resource is. In some cases it might
>> be a document, in others a table in a DB.
>>
>> Christian W. Damus wrote:
>>> Hi, Andrew,
>>>
>>> EMF's EObject IDs are intended to be resource-unique, as in XSD. The
>>> UUID utility is a convenience for generating IDs that probably are
>>> universally unique, but nothing in EMF expects this property.
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>> Andrew H wrote:
>>>> As discussed in
>>>> http://www.eclipse.org/newsportal/article.php?id=36086&g roup=eclipse.tools.emf#36086
>>>>
>>>>
>>>> I started with some XSD's, generated EMF models and then persisted
>>>> with Teneo. Fields that were declared in XSD as ID fields went into
>>>> EMF as ID fields and then as id elements in the hibernate mappings.
>>>> i.e. these fields became primary key fields.
>>>>
>>>> However, the XSD authors never intended them to be globally unique,
>>>> just unique within a single document. They use IDREF fields
>>>> elsewhere in the doc to refer to them.
>>>>
>>>> Consequently they are not suitable as id fields in the hibernate
>>>> mappings.
>>>>
>>>> I fixed this with Martin's help by turning off the mapping from EMF
>>>> ID to hibernate id.
>>>>
>>>> However, its not clear to me whether this was the best place to fix
>>>> it. Is the semantics of ID in EMF that the field is intended to be a
>>>> unique primary key for that class?
>>>>
>>>> If so then I should probably sever the mapping of XSD ID to EMF ID
>>>> for these fields instead? If so how do I do that?
>>>>
>>>> Thoughts?
>>>>
>>>>
>>>>
>
>


--

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: XSD ID -> EMF ID -> hibernate id [message #423654 is a reply to message #423651] Sat, 04 October 2008 16:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Martin,

Perhaps Andrew would enjoy being Spanish for a day?

You should use the Dvorak layout, as I do. There is a greater
separation between the S and the W. My own problem is between the N and
S, and the A and O. I sometimes sign my own name as Christios ... looks
vaguely Greek.

:-D

On a more serious note, I think the mapping of EMF's resource do the
database as a whole is very intuitive. It's convenient to have a closed
universe containing everything, and external references modeled simply
as URIs, which makes for a very explicit proxy concept.

cW


Martin Taal wrote:
> And here with the correct spelling of your name, sorry (the s and w are
> too close to eachother for my fingers apparently :-)
>
> Hi Andrew,
> Or the resource represents the whole database, with Teneo a resource is
> connected to the database as a whole, i.e. a Teneo EMF resource uses a
> hibernate session and with queries you can load data from all the tables
> into the resource.
>
> gr. Martin
>
> Martin Taal wrote:
>>
>> andrew987650000@yahoo.com.au wrote:
>>> Thanks Christian
>>>
>>> So I guess it comes down to what a resource is. In some cases it
>>> might be a document, in others a table in a DB.
>>>
>>> Christian W. Damus wrote:
>>>> Hi, Andrew,
>>>>
>>>> EMF's EObject IDs are intended to be resource-unique, as in XSD.
>>>> The UUID utility is a convenience for generating IDs that probably
>>>> are universally unique, but nothing in EMF expects this property.
>>>>
>>>> HTH,
>>>>
>>>> Christian
>>>>
>>>> Andrew H wrote:
>>>>> As discussed in
>>>>> http://www.eclipse.org/newsportal/article.php?id=36086&g roup=eclipse.tools.emf#36086
>>>>>
>>>>>
>>>>> I started with some XSD's, generated EMF models and then persisted
>>>>> with Teneo. Fields that were declared in XSD as ID fields went into
>>>>> EMF as ID fields and then as id elements in the hibernate mappings.
>>>>> i.e. these fields became primary key fields.
>>>>>
>>>>> However, the XSD authors never intended them to be globally unique,
>>>>> just unique within a single document. They use IDREF fields
>>>>> elsewhere in the doc to refer to them.
>>>>>
>>>>> Consequently they are not suitable as id fields in the hibernate
>>>>> mappings.
>>>>>
>>>>> I fixed this with Martin's help by turning off the mapping from EMF
>>>>> ID to hibernate id.
>>>>>
>>>>> However, its not clear to me whether this was the best place to fix
>>>>> it. Is the semantics of ID in EMF that the field is intended to be
>>>>> a unique primary key for that class?
>>>>>
>>>>> If so then I should probably sever the mapping of XSD ID to EMF ID
>>>>> for these fields instead? If so how do I do that?
>>>>>
>>>>> Thoughts?
>>>>>
>>>>>
>>>>>
>>
>>
>
>
Re: XSD ID -> EMF ID -> hibernate id [message #423759 is a reply to message #423654] Tue, 07 October 2008 06:16 Go to previous message
Andrew H is currently offline Andrew HFriend
Messages: 117
Registered: July 2009
Senior Member
Thanks Christios & Marten :-)

So I think the problem then in this case is the association with XSD ID
and EMF ID. The XSD's that I originally imported are for B2B applications.
They use XML ID for references within a document. I should stop these
mapping to EMF ID fields as this implies uniqueness withing our database
for these objects.

thanks for everyones thoughts

Christian W. Damus wrote:

> Hi, Martin,

> Perhaps Andrew would enjoy being Spanish for a day?

> You should use the Dvorak layout, as I do. There is a greater
> separation between the S and the W. My own problem is between the N and
> S, and the A and O. I sometimes sign my own name as Christios ... looks
> vaguely Greek.

> :-D

> On a more serious note, I think the mapping of EMF's resource do the
> database as a whole is very intuitive. It's convenient to have a closed
> universe containing everything, and external references modeled simply
> as URIs, which makes for a very explicit proxy concept.

> cW


> Martin Taal wrote:
>> And here with the correct spelling of your name, sorry (the s and w are
>> too close to eachother for my fingers apparently :-)
>>
>> Hi Andrew,
>> Or the resource represents the whole database, with Teneo a resource is
>> connected to the database as a whole, i.e. a Teneo EMF resource uses a
>> hibernate session and with queries you can load data from all the tables
>> into the resource.
>>
>> gr. Martin
>>
>> Martin Taal wrote:
>>>
>>> andrew987650000@yahoo.com.au wrote:
>>>> Thanks Christian
>>>>
>>>> So I guess it comes down to what a resource is. In some cases it
>>>> might be a document, in others a table in a DB.
>>>>
>>>> Christian W. Damus wrote:
>>>>> Hi, Andrew,
>>>>>
>>>>> EMF's EObject IDs are intended to be resource-unique, as in XSD.
>>>>> The UUID utility is a convenience for generating IDs that probably
>>>>> are universally unique, but nothing in EMF expects this property.
>>>>>
>>>>> HTH,
>>>>>
>>>>> Christian
>>>>>
>>>>> Andrew H wrote:
>>>>>> As discussed in
>>>>>>
http://www.eclipse.org/newsportal/article.php?id=36086&g roup=eclipse.tools.emf#36086
>>>>>>
>>>>>>
>>>>>> I started with some XSD's, generated EMF models and then persisted
>>>>>> with Teneo. Fields that were declared in XSD as ID fields went into
>>>>>> EMF as ID fields and then as id elements in the hibernate mappings.
>>>>>> i.e. these fields became primary key fields.
>>>>>>
>>>>>> However, the XSD authors never intended them to be globally unique,
>>>>>> just unique within a single document. They use IDREF fields
>>>>>> elsewhere in the doc to refer to them.
>>>>>>
>>>>>> Consequently they are not suitable as id fields in the hibernate
>>>>>> mappings.
>>>>>>
>>>>>> I fixed this with Martin's help by turning off the mapping from EMF
>>>>>> ID to hibernate id.
>>>>>>
>>>>>> However, its not clear to me whether this was the best place to fix
>>>>>> it. Is the semantics of ID in EMF that the field is intended to be
>>>>>> a unique primary key for that class?
>>>>>>
>>>>>> If so then I should probably sever the mapping of XSD ID to EMF ID
>>>>>> for these fields instead? If so how do I do that?
>>>>>>
>>>>>> Thoughts?
>>>>>>
>>>>>>
>>>>>>
>>>
>>>
>>
>>
Previous Topic:Loosing xsi:schemaLocation after serialization
Next Topic:[CDO] why getCreationIme is Unsupported in HibernateStore
Goto Forum:
  


Current Time: Sat Apr 20 03:04:36 GMT 2024

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

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

Back to the top