Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » CDO and generated model Impl
CDO and generated model Impl [message #67271] Mon, 08 January 2007 14:49 Go to next message
Eclipse UserFriend
Originally posted by: yannick.lizzi.silogic.fr

Hi (again)

I have a question regarding the generated code for CDO model.

The multiple associations (aggregation or not) are generated as follow:

public EList getMyChildren() {
cdoLoad();
if (children == null) (
// init children
...
}
return children;
}

But in case of simple association, the generated code is as follow:

public Children getMyChildren() {
if (children != null && children.isProxy()) {
// resolving proxy
...
}
return children;
}

My question is: why the generated getter does not start with cdoLoad()
in the simple relation case?
This leads to problems (in my code at least): when I load my object
model via some container classes, I call getMyChildren() where I know
there is a children (confirmed also by the database content) and this
result to a null value.

Of course if I invoke cdoLoad() before each call of getMyChildren()
(either in my impl code or in the calling code) it works but I was
thinking of something more automatic if not direcly generated.

Yannick
Re: CDO and generated model Impl [message #67284 is a reply to message #67271] Mon, 08 January 2007 15:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

Hi Yannick,

I believe that this has been fixed in the context of
https://bugs.eclipse.org/bugs/show_bug.cgi?id=162961
The changes are committed to the R0_7_maintenance branch. Unfortunately
I can't publish a new build right now due to an issue with the build system.

If you don't want to checkout from CVS, you can also try to change the
following files to only contain "cdoLoad();"

/org.eclipse.emf.cdo.client/templates/model/Class/getGenFeat ure.pre.insert.javajetinc


/org.eclipse.emf.cdo.client/templates/model/Class/setGenFeat ure.pre.insert.javajetinc


and regenerate your models!
Does this help?

Cheers
/Eike


Yannick Lizzi schrieb:
> Hi (again)
>
> I have a question regarding the generated code for CDO model.
>
> The multiple associations (aggregation or not) are generated as follow:
>
> public EList getMyChildren() {
> cdoLoad();
> if (children == null) (
> // init children
> ...
> }
> return children;
> }
>
> But in case of simple association, the generated code is as follow:
>
> public Children getMyChildren() {
> if (children != null && children.isProxy()) {
> // resolving proxy
> ...
> }
> return children;
> }
>
> My question is: why the generated getter does not start with cdoLoad()
> in the simple relation case?
> This leads to problems (in my code at least): when I load my object
> model via some container classes, I call getMyChildren() where I know
> there is a children (confirmed also by the database content) and this
> result to a null value.
>
> Of course if I invoke cdoLoad() before each call of getMyChildren()
> (either in my impl code or in the calling code) it works but I was
> thinking of something more automatic if not direcly generated.
>
> Yannick
Re: CDO and generated model Impl [message #67313 is a reply to message #67284] Mon, 08 January 2007 16:44 Go to previous message
Eclipse UserFriend
Originally posted by: yannick.lizzi.silogic.fr

Hi Eike

OK I was indeed working with the R0_7_maintenance version, but I did not
regenerate the model.
Now I see the cdoLoad() methods everywhere.

Thanks
Yannick


Eike Stepper a écrit :
> Hi Yannick,
>
> I believe that this has been fixed in the context of
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=162961
> The changes are committed to the R0_7_maintenance branch. Unfortunately
> I can't publish a new build right now due to an issue with the build
> system.
>
> If you don't want to checkout from CVS, you can also try to change the
> following files to only contain "cdoLoad();"
>
> /org.eclipse.emf.cdo.client/templates/model/Class/getGenFeat ure.pre.insert.javajetinc
>
>
> /org.eclipse.emf.cdo.client/templates/model/Class/setGenFeat ure.pre.insert.javajetinc
>
>
> and regenerate your models!
> Does this help?
>
> Cheers
> /Eike
>
>
> Yannick Lizzi schrieb:
>> Hi (again)
>>
>> I have a question regarding the generated code for CDO model.
>>
>> The multiple associations (aggregation or not) are generated as follow:
>>
>> public EList getMyChildren() {
>> cdoLoad();
>> if (children == null) (
>> // init children
>> ...
>> }
>> return children;
>> }
>>
>> But in case of simple association, the generated code is as follow:
>>
>> public Children getMyChildren() {
>> if (children != null && children.isProxy()) {
>> // resolving proxy
>> ...
>> }
>> return children;
>> }
>>
>> My question is: why the generated getter does not start with cdoLoad()
>> in the simple relation case?
>> This leads to problems (in my code at least): when I load my object
>> model via some container classes, I call getMyChildren() where I know
>> there is a children (confirmed also by the database content) and this
>> result to a null value.
>>
>> Of course if I invoke cdoLoad() before each call of getMyChildren()
>> (either in my impl code or in the calling code) it works but I was
>> thinking of something more automatic if not direcly generated.
>>
>> Yannick
Re: CDO and generated model Impl [message #600891 is a reply to message #67271] Mon, 08 January 2007 15:50 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6538
Registered: July 2009
Senior Member
Hi Yannick,

I believe that this has been fixed in the context of
https://bugs.eclipse.org/bugs/show_bug.cgi?id=162961
The changes are committed to the R0_7_maintenance branch. Unfortunately
I can't publish a new build right now due to an issue with the build system.

If you don't want to checkout from CVS, you can also try to change the
following files to only contain "cdoLoad();"

/org.eclipse.emf.cdo.client/templates/model/Class/getGenFeat ure.pre.insert.javajetinc


/org.eclipse.emf.cdo.client/templates/model/Class/setGenFeat ure.pre.insert.javajetinc


and regenerate your models!
Does this help?

Cheers
/Eike


Yannick Lizzi schrieb:
> Hi (again)
>
> I have a question regarding the generated code for CDO model.
>
> The multiple associations (aggregation or not) are generated as follow:
>
> public EList getMyChildren() {
> cdoLoad();
> if (children == null) (
> // init children
> ...
> }
> return children;
> }
>
> But in case of simple association, the generated code is as follow:
>
> public Children getMyChildren() {
> if (children != null && children.isProxy()) {
> // resolving proxy
> ...
> }
> return children;
> }
>
> My question is: why the generated getter does not start with cdoLoad()
> in the simple relation case?
> This leads to problems (in my code at least): when I load my object
> model via some container classes, I call getMyChildren() where I know
> there is a children (confirmed also by the database content) and this
> result to a null value.
>
> Of course if I invoke cdoLoad() before each call of getMyChildren()
> (either in my impl code or in the calling code) it works but I was
> thinking of something more automatic if not direcly generated.
>
> Yannick


Re: CDO and generated model Impl [message #600919 is a reply to message #67284] Mon, 08 January 2007 16:44 Go to previous message
Eclipse UserFriend
Originally posted by: yannick.lizzi.silogic.fr

Hi Eike

OK I was indeed working with the R0_7_maintenance version, but I did not
regenerate the model.
Now I see the cdoLoad() methods everywhere.

Thanks
Yannick


Eike Stepper a écrit :
> Hi Yannick,
>
> I believe that this has been fixed in the context of
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=162961
> The changes are committed to the R0_7_maintenance branch. Unfortunately
> I can't publish a new build right now due to an issue with the build
> system.
>
> If you don't want to checkout from CVS, you can also try to change the
> following files to only contain "cdoLoad();"
>
> /org.eclipse.emf.cdo.client/templates/model/Class/getGenFeat ure.pre.insert.javajetinc
>
>
> /org.eclipse.emf.cdo.client/templates/model/Class/setGenFeat ure.pre.insert.javajetinc
>
>
> and regenerate your models!
> Does this help?
>
> Cheers
> /Eike
>
>
> Yannick Lizzi schrieb:
>> Hi (again)
>>
>> I have a question regarding the generated code for CDO model.
>>
>> The multiple associations (aggregation or not) are generated as follow:
>>
>> public EList getMyChildren() {
>> cdoLoad();
>> if (children == null) (
>> // init children
>> ...
>> }
>> return children;
>> }
>>
>> But in case of simple association, the generated code is as follow:
>>
>> public Children getMyChildren() {
>> if (children != null && children.isProxy()) {
>> // resolving proxy
>> ...
>> }
>> return children;
>> }
>>
>> My question is: why the generated getter does not start with cdoLoad()
>> in the simple relation case?
>> This leads to problems (in my code at least): when I load my object
>> model via some container classes, I call getMyChildren() where I know
>> there is a children (confirmed also by the database content) and this
>> result to a null value.
>>
>> Of course if I invoke cdoLoad() before each call of getMyChildren()
>> (either in my impl code or in the calling code) it works but I was
>> thinking of something more automatic if not direcly generated.
>>
>> Yannick
Previous Topic:Teneo: .ejdo usage in generated editor
Next Topic:CDO and eContainer()
Goto Forum:
  


Current Time: Sun Feb 28 07:59:08 GMT 2021

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

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

Back to the top