Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Re: Teneo map references in one table
Re: Teneo map references in one table [message #428106] Tue, 10 March 2009 19:50 Go to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Flavio,
I don't know if this is possible (at least I don't know right away how to do this). With many, do you mean many-to-many
or one-to-many? For the latter you can set an option to prevent the default to use join tables (set the option:
PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS to false).

btw, support for Teneo is given on the main EMF newsgroup, which I added on the to.

gr. Martin

Flavio Donzé wrote:
> Hello Martin
>
> We have a lot of references in our ecore model. Teneo creates for all
> the 'many' references a separated table.
> Now is it some how possible to map all the references in one table?
> Something like:
> References(ObjectUUID, FeatureName, ReferenceUUID, Index, ObjectName,
> ReferenceName)
> ('person uuid','roles','role uuid','index','person','role')
>
> The references are always the same (non-containment, index ....).
>
> Maybe there is some kind of hock in where I can change the mapping,
> storing and reading of references?
>
> Thanks for any info
> Flavio
>
>
>


--

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 map references in one table [message #428114 is a reply to message #428106] Wed, 11 March 2009 08:57 Go to previous messageGo to next message
Flavio Donze is currently offline Flavio DonzeFriend
Messages: 211
Registered: July 2009
Location: Switzerland
Senior Member
Hey Martin

Thanks for the information.
I tried the JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS option, not exactly
what I need. In my Person/Role connection the 'role' table is extended
with two new fields (person_roles_id and person_roles_idx).
I would like to have a global table for all references, so it would be
easier for us to check if an object has references and for reporting.

Is there a way to manipulate the mapping (without passing the mapping
file)?
org.hibernate.Interceptor won't help me in this case I guess.
Maybe extend or override some component?

cheers
Flavio

Martin Taal wrote:

> Hi Flavio,
> I don't know if this is possible (at least I don't know right away how to do
this). With many, do you mean many-to-many
> or one-to-many? For the latter you can set an option to prevent the default
to use join tables (set the option:
> PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS to false).

> btw, support for Teneo is given on the main EMF newsgroup, which I added on
the to.

> gr. Martin

> Flavio Donzé wrote:
>> Hello Martin
>>
>> We have a lot of references in our ecore model. Teneo creates for all
>> the 'many' references a separated table.
>> Now is it some how possible to map all the references in one table?
>> Something like:
>> References(ObjectUUID, FeatureName, ReferenceUUID, Index, ObjectName,
>> ReferenceName)
>> ('person uuid','roles','role uuid','index','person','role')
>>
>> The references are always the same (non-containment, index ....).
>>
>> Maybe there is some kind of hock in where I can change the mapping,
>> storing and reading of references?
>>
>> Thanks for any info
>> Flavio
>>
>>
>>


Prozessmanagement und Qualitätsmanagement Software QMS/IMS
https://www.scodi.ch
Re: Teneo map references in one table [message #428123 is a reply to message #428114] Wed, 11 March 2009 12:53 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Flavio,
I have thought about this for a few hours... Hibernate uses the OneToManyPersister class to persist a one to many. But
afaics this one can not be customized (and it looks rather difficult to change). So the only thing I can come up with is
to look at implementing a custom hibernate UserType (see the hibernate manual) and map all EReferences using this
usertype and a common join table.
However, usertypes are mostly used for primitive values or external references. What I am not sure about is if you need
to implement cascade behavior manually (if even possible) if you use a usertype for an ereference.

Can you check the hibernate manual/internet to look for usertypes for associations?

Another option for you is to explicitly model the common join table and have it there next to the 'normal' references
between two objects. Then when the 'normal' reference is updated also the common joined object is updated and vice
versa. You can then prevent Teneo/hibernate from persisting the 'normal' references by making them transient.

gr. Martin

Flavio Donzé wrote:
> Hey Martin
>
> Thanks for the information.
> I tried the JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS option, not
> exactly what I need. In my Person/Role connection the 'role' table is
> extended with two new fields (person_roles_id and person_roles_idx).
> I would like to have a global table for all references, so it would be
> easier for us to check if an object has references and for reporting.
>
> Is there a way to manipulate the mapping (without passing the mapping
> file)?
> org.hibernate.Interceptor won't help me in this case I guess.
> Maybe extend or override some component?
>
> cheers
> Flavio
>
> Martin Taal wrote:
>
>> Hi Flavio,
>> I don't know if this is possible (at least I don't know right away how
>> to do
> this). With many, do you mean many-to-many
>> or one-to-many? For the latter you can set an option to prevent the
>> default
> to use join tables (set the option:
>> PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS to false).
>
>> btw, support for Teneo is given on the main EMF newsgroup, which I
>> added on
> the to.
>
>> gr. Martin
>
>> Flavio Donzé wrote:
>>> Hello Martin
>>>
>>> We have a lot of references in our ecore model. Teneo creates for all
>>> the 'many' references a separated table.
>>> Now is it some how possible to map all the references in one table?
>>> Something like:
>>> References(ObjectUUID, FeatureName, ReferenceUUID, Index, ObjectName,
>>> ReferenceName)
>>> ('person uuid','roles','role uuid','index','person','role')
>>>
>>> The references are always the same (non-containment, index ....).
>>>
>>> Maybe there is some kind of hock in where I can change the mapping,
>>> storing and reading of references?
>>>
>>> Thanks for any info
>>> Flavio
>>>
>>>
>>>
>
>
>
>


--

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 map references in one table [message #428247 is a reply to message #428123] Mon, 16 March 2009 10:51 Go to previous messageGo to next message
Flavio Donze is currently offline Flavio DonzeFriend
Messages: 211
Registered: July 2009
Location: Switzerland
Senior Member
Hi Martin

I searched the web and check my hibernate book. The best article I found
was that one: http://www.hibernate.org/122.html
The problem here is that Teneo does not support the @Any annotation
(http://www.elver.org/hibernate/ejb3_features.html).
In our software we can not provide the mapping file directly to hibernate.

Well I will do some more thinking, this issue is not so urgent to us. I
will notify you if I come up with a solution.

cheers
Flavio


Martin Taal wrote:

> Hi Flavio,
> I have thought about this for a few hours... Hibernate uses the
OneToManyPersister class to persist a one to many. But
> afaics this one can not be customized (and it looks rather difficult to
change). So the only thing I can come up with is
> to look at implementing a custom hibernate UserType (see the hibernate
manual) and map all EReferences using this
> usertype and a common join table.
> However, usertypes are mostly used for primitive values or external
references. What I am not sure about is if you need
> to implement cascade behavior manually (if even possible) if you use a
usertype for an ereference.

> Can you check the hibernate manual/internet to look for usertypes for
associations?

> Another option for you is to explicitly model the common join table and have
it there next to the 'normal' references
> between two objects. Then when the 'normal' reference is updated also the
common joined object is updated and vice
> versa. You can then prevent Teneo/hibernate from persisting the 'normal'
references by making them transient.

> gr. Martin

> Flavio Donzé wrote:
>> Hey Martin
>>
>> Thanks for the information.
>> I tried the JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS option, not
>> exactly what I need. In my Person/Role connection the 'role' table is
>> extended with two new fields (person_roles_id and person_roles_idx).
>> I would like to have a global table for all references, so it would be
>> easier for us to check if an object has references and for reporting.
>>
>> Is there a way to manipulate the mapping (without passing the mapping
>> file)?
>> org.hibernate.Interceptor won't help me in this case I guess.
>> Maybe extend or override some component?
>>
>> cheers
>> Flavio
>>
>> Martin Taal wrote:
>>
>>> Hi Flavio,
>>> I don't know if this is possible (at least I don't know right away how
>>> to do
>> this). With many, do you mean many-to-many
>>> or one-to-many? For the latter you can set an option to prevent the
>>> default
>> to use join tables (set the option:
>>> PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS to false).
>>
>>> btw, support for Teneo is given on the main EMF newsgroup, which I
>>> added on
>> the to.
>>
>>> gr. Martin
>>
>>> Flavio Donzé wrote:
>>>> Hello Martin
>>>>
>>>> We have a lot of references in our ecore model. Teneo creates for all
>>>> the 'many' references a separated table.
>>>> Now is it some how possible to map all the references in one table?
>>>> Something like:
>>>> References(ObjectUUID, FeatureName, ReferenceUUID, Index, ObjectName,
>>>> ReferenceName)
>>>> ('person uuid','roles','role uuid','index','person','role')
>>>>
>>>> The references are always the same (non-containment, index ....).
>>>>
>>>> Maybe there is some kind of hock in where I can change the mapping,
>>>> storing and reading of references?
>>>>
>>>> Thanks for any info
>>>> Flavio
>>>>
>>>>
>>>>
>>
>>
>>
>>


Prozessmanagement und Qualitätsmanagement Software QMS/IMS
https://www.scodi.ch
Re: Teneo map references in one table [message #428250 is a reply to message #428247] Mon, 16 March 2009 11:07 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Flavio,
For your info, actually Teneo uses the hibernate any type to map EReferences which point to EObject (and not to a
specific type). So the only thing missing here is the annotation to make it more controllable...
If you need it then feel free to enter a bugzilla for it.

gr. Martin

Flavio Donzé wrote:
> Hi Martin
>
> I searched the web and check my hibernate book. The best article I found
> was that one: http://www.hibernate.org/122.html
> The problem here is that Teneo does not support the @Any annotation
> (http://www.elver.org/hibernate/ejb3_features.html).
> In our software we can not provide the mapping file directly to hibernate.
>
> Well I will do some more thinking, this issue is not so urgent to us. I
> will notify you if I come up with a solution.
>
> cheers
> Flavio
>
>
> Martin Taal wrote:
>
>> Hi Flavio,
>> I have thought about this for a few hours... Hibernate uses the
> OneToManyPersister class to persist a one to many. But
>> afaics this one can not be customized (and it looks rather difficult to
> change). So the only thing I can come up with is
>> to look at implementing a custom hibernate UserType (see the hibernate
> manual) and map all EReferences using this
>> usertype and a common join table.
>> However, usertypes are mostly used for primitive values or external
> references. What I am not sure about is if you need
>> to implement cascade behavior manually (if even possible) if you use a
> usertype for an ereference.
>
>> Can you check the hibernate manual/internet to look for usertypes for
> associations?
>
>> Another option for you is to explicitly model the common join table
>> and have
> it there next to the 'normal' references
>> between two objects. Then when the 'normal' reference is updated also the
> common joined object is updated and vice
>> versa. You can then prevent Teneo/hibernate from persisting the 'normal'
> references by making them transient.
>
>> gr. Martin
>
>> Flavio Donzé wrote:
>>> Hey Martin
>>>
>>> Thanks for the information.
>>> I tried the JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS option, not
>>> exactly what I need. In my Person/Role connection the 'role' table is
>>> extended with two new fields (person_roles_id and person_roles_idx).
>>> I would like to have a global table for all references, so it would
>>> be easier for us to check if an object has references and for reporting.
>>>
>>> Is there a way to manipulate the mapping (without passing the mapping
>>> file)?
>>> org.hibernate.Interceptor won't help me in this case I guess.
>>> Maybe extend or override some component?
>>>
>>> cheers
>>> Flavio
>>>
>>> Martin Taal wrote:
>>>
>>>> Hi Flavio,
>>>> I don't know if this is possible (at least I don't know right away
>>>> how to do
>>> this). With many, do you mean many-to-many
>>>> or one-to-many? For the latter you can set an option to prevent the
>>>> default
>>> to use join tables (set the option:
>>>> PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS to false).
>>>
>>>> btw, support for Teneo is given on the main EMF newsgroup, which I
>>>> added on
>>> the to.
>>>
>>>> gr. Martin
>>>
>>>> Flavio Donzé wrote:
>>>>> Hello Martin
>>>>>
>>>>> We have a lot of references in our ecore model. Teneo creates for
>>>>> all the 'many' references a separated table.
>>>>> Now is it some how possible to map all the references in one table?
>>>>> Something like:
>>>>> References(ObjectUUID, FeatureName, ReferenceUUID, Index,
>>>>> ObjectName, ReferenceName)
>>>>> ('person uuid','roles','role uuid','index','person','role')
>>>>>
>>>>> The references are always the same (non-containment, index ....).
>>>>>
>>>>> Maybe there is some kind of hock in where I can change the mapping,
>>>>> storing and reading of references?
>>>>>
>>>>> Thanks for any info
>>>>> Flavio
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>
>
>
>


--

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
Previous Topic:Will eStore.get with EStore.NO_INDEX on a many efeature, return a List?
Next Topic:Show new IProgressMonitor
Goto Forum:
  


Current Time: Sat Apr 20 01:57:01 GMT 2024

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

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

Back to the top