Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [cdo] Containment always has 0 as its cdo_resource
[cdo] Containment always has 0 as its cdo_resource [message #1400717] Mon, 14 July 2014 16:12 Go to next message
saurav singh is currently offline saurav singhFriend
Messages: 21
Registered: August 2013
Junior Member
Is it necessary that containment should have its cdo_resource id as 0 ?? Will it be problematic if it has some thing else as cdo_resource ?
Re: [cdo] Containment always has 0 as its cdo_resource [message #1401131 is a reply to message #1400717] Tue, 15 July 2014 07:13 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

What reference do you talk about? Do you talk about
org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision.resourceID class
property?

Le 14/07/2014 18:12, saurav singh a écrit :
> Is it necessary that containment should have its cdo_resource id as 0 ??
> Will it be problematic if it has some thing else as cdo_resource ?
Re: [cdo] Containment always has 0 as its cdo_resource [message #1401157 is a reply to message #1401131] Tue, 15 July 2014 08:00 Go to previous messageGo to next message
saurav singh is currently offline saurav singhFriend
Messages: 21
Registered: August 2013
Junior Member
I am using db store and when I save a new object with a containment inside( let say A is an object and has a containment B like A -> B) the object would save in the resource given (i.e. resource_id of A in mysql table would be the cdo_id of the given resource) but containment would save in some resource with cdo_id as 0 (i.e. B would have its resource_id as 0 in mysql table)
Re: [cdo] Containment always has 0 as its cdo_resource [message #1401214 is a reply to message #1401157] Tue, 15 July 2014 09:42 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Perhaps the DB persistence part of CDO set affects a resource_id only
for objects of top level, i.e. objects directly in
CDOResource.getContents(). Then when fetching CDORevision from the DB
table, it can retreive resource_id from its containers.

Best Regards.

Le 15/07/2014 10:00, saurav singh a écrit :
> I am using db store and when I save a new object with a containment
> inside( let say A is an object and has a containment B like A -> B) the
> object would save in the resource given (i.e. resource_id of A in mysql
> table would be the cdo_id of the given resource) but containment would
> save in some resource with cdo_id as 0 (i.e. B would have its
> resource_id as 0 in mysql table)
Re: [cdo] Containment always has 0 as its cdo_resource [message #1401354 is a reply to message #1401214] Tue, 15 July 2014 13:25 Go to previous messageGo to next message
saurav singh is currently offline saurav singhFriend
Messages: 21
Registered: August 2013
Junior Member
Thanks for your reply. So could it be problematic if I change the code which set the cdoresource for contaiments ?
Re: [cdo] Containment always has 0 as its cdo_resource [message #1401491 is a reply to message #1401354] Tue, 15 July 2014 17:46 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Yes. All of your objects will end up in the contents list of the
corresponding CDOResources, instead of being indirectly contained by
way of their containers. Not only will this make some potentially very
large contents-lists, but if your model isn't generated with support
for containment proxies, then there will be a conflict: your objects
will only be able to be contained either by a resource or by a parent
object, but not both. At least, assuming that this is a "legacy" model
and not generated specifically for CDO ...

HTH,

Christian

On 2014-07-15 13:25:52 +0000, saurav singh said:

> Thanks for your reply. So could it be problematic if I change the code
> which set the cdoresource for contaiments ?
Re: [cdo] Containment always has 0 as its cdo_resource [message #1402886 is a reply to message #1401491] Fri, 18 July 2014 08:16 Go to previous messageGo to next message
saurav singh is currently offline saurav singhFriend
Messages: 21
Registered: August 2013
Junior Member
Its very hard to find that where the actual code is for setting resource_id for the new added element. It would be great if someone can help me here.
Re: [cdo] Containment always has 0 as its cdo_resource [message #1402956 is a reply to message #1402886] Fri, 18 July 2014 16:38 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
You should not use this manually, especially if you rely on the CDO cache/auditing/branching to work properly.
I think what you want is something like this:

EClass Parent:
- containment Child children 0 .. *

EClass Child:
- EString someAttribute

So, you have an ECLass "Parent" that is the container of objects of type "Child".
If you want to make the cdo tables have the cdo_resource set, you should *move* the child from the container to the resource (this is what Christophe said: either contained in a resource OR in a container):

Resource resource = ... // get your resource from CDO
Parent parent = ... // your business object that is the container
Child child = parent.getChildren(0); // the child you want to move to the resource
resource.getContents().add(child);


If you do not know what this all means, I think you should first get familiar with EMF, then try to adapt CDO.

saurav singh wrote on Fri, 18 July 2014 10:16
Its very hard to find that where the actual code is for setting resource_id for the new added element. It would be great if someone can help me here.

Previous Topic:[CDO] Security manager failing in 'mem' store configuration ?
Next Topic:[CDO] Add content of XMI file to existing CDO resource - too slow
Goto Forum:
  


Current Time: Fri Apr 19 21:49:59 GMT 2024

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

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

Back to the top