Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEList
[teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEList [message #83177] Fri, 11 May 2007 10:54 Go to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83193 is a reply to message #83177] Fri, 11 May 2007 11:11 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
Is parent of the Product already present in the resource?

gr. Martin

Anthony wrote:
> Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>


--

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: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83204 is a reply to message #83177] Fri, 11 May 2007 11:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Anthony,

This sounds like expected behavior. For non-proxy resolving containment
reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents. Only
for proxy resolving containment is it possible to put a "child" in to a
separate resource. Note that if Products parent is already in a
resource then product.eResource() will be non-null, and there is no need
to put the Product directly in the resource since it's indirectly
contained in the resource by virtue of the parent being contained in a
resource.

Anthony wrote:
> Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83211 is a reply to message #83193] Fri, 11 May 2007 11:21 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin Taal <mtaal@elver.org> wrote in news:f21j0e$hdh$1
@build.eclipse.org:

> Hi,
> Is parent of the Product already present in the resource?
>
> gr. Martin
>
> Anthony wrote:
>> Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>
>

Hi,
It is not.
I have to use another resource to init the parent to get it
as EMF owner object to create AddChild command.

It seems the saving action would fail since the parent is not in the
same resource, but if the eContainer is not removed then the element is
saved in DB.

Anthony
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83227 is a reply to message #83204] Fri, 11 May 2007 11:41 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




> Anthony,
>
> This sounds like expected behavior. For non-proxy resolving
containment
> reference (EReference.isResolveProxies == true), eContainer and
> eDirectResource mutually exclusive, i.e., you can't have an EObject
> container and be contained directly by a resource's getContents. Only
> for proxy resolving containment is it possible to put a "child" in to
a
> separate resource. Note that if Products parent is already in a
> resource then product.eResource() will be non-null, and there is no
need
> to put the Product directly in the resource since it's indirectly
> contained in the resource by virtue of the parent being contained in a
> resource.
>
> Anthony wrote:
>> Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>>
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83243 is a reply to message #83227] Fri, 11 May 2007 12:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------040705060809080707090006
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anthony,

I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's the
eOpposite of the containment feature).


Anthony wrote:
> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
> @build.eclipse.org:
>
> Merks,
>
> Thanks.
>
> So if the container is set as transient, how to persist the
> container's element ?
>
>
>
> Anthony
>
>
>
>
>
>> Anthony,
>>
>> This sounds like expected behavior. For non-proxy resolving
>>
> containment
>
>> reference (EReference.isResolveProxies == true), eContainer and
>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>> container and be contained directly by a resource's getContents. Only
>> for proxy resolving containment is it possible to put a "child" in to
>>
> a
>
>> separate resource. Note that if Products parent is already in a
>> resource then product.eResource() will be non-null, and there is no
>>
> need
>
>> to put the Product directly in the resource since it's indirectly
>> contained in the resource by virtue of the parent being contained in a
>> resource.
>>
>> Anthony wrote:
>>
>>> Hi,
>>>
>>> In my EMF model , Product and ProductRegistry has many-To-one
>>> relationship and ProductRegistry set as transient.
>>>
>>> I create a new Product and set it's eContainer as not null
>>> and then add this Product element into HibernateResourse's
>>> contents, in inverseAdd() ,the eContainer is removed.
>>>
>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>> to make the isResolveProxy() return true, I could stop this removal.
>>>
>>> Do I need to set something in hibernate.hbm.xml?
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>
>


--------------040705060809080707090006
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Anthony,<br>
<br>
I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).<br>
<br>
<br>
Anthony wrote:
<blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
type="cite">
<pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

This sounds like expected behavior. For non-proxy resolving
</pre>
</blockquote>
<pre wrap=""><!---->containment
</pre>
<blockquote type="cite">
<pre wrap="">reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents. Only
for proxy resolving containment is it possible to put a "child" in to
</pre>
</blockquote>
<pre wrap=""><!---->a
</pre>
<blockquote type="cite">
<pre wrap="">separate resource. Note that if Products parent is already in a
resource then product.eResource() will be non-null, and there is no
</pre>
</blockquote>
<pre wrap=""><!---->need
</pre>
<blockquote type="cite">
<pre wrap="">to put the Product directly in the resource since it's indirectly
contained in the resource by virtue of the parent being contained in a
resource.

Anthony wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------040705060809080707090006--
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83257 is a reply to message #83243] Fri, 11 May 2007 12:26 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I choose
to change them to many-to-one's (so only persist the reference from the
child to the parent) and load the one-to-many relation (parent to child)
on demand through an explicit query (make the many-reference from the
parent to the child transient). Adding to the parent is then done by
setting the parent feature in the child.



Anthony





> Anthony,
>
> I'm not sure I completely follow what you are asking (container is set
> as transient implies you don't want to serialize it), but in the XMI
> serialization, to serialize a reference to the container, you need to
> define a non-transient container feature (i.e., an EReference that's
> the eOpposite of the containment feature).
>
>
> Anthony wrote:
>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>> @build.eclipse.org:
>>
>> Merks,
>>
>> Thanks.
>>
>> So if the container is set as transient, how to persist the
>> container's element ?
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>>
>>> Anthony,
>>>
>>> This sounds like expected behavior. For non-proxy resolving
>>>
>> containment
>>
>>> reference (EReference.isResolveProxies == true), eContainer and
>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>> container and be contained directly by a resource's getContents.
>>> Only for proxy resolving containment is it possible to put a "child"
>>> in to
>>>
>> a
>>
>>> separate resource. Note that if Products parent is already in a
>>> resource then product.eResource() will be non-null, and there is no
>>>
>> need
>>
>>> to put the Product directly in the resource since it's indirectly
>>> contained in the resource by virtue of the parent being contained in
>>> a resource.
>>>
>>> Anthony wrote:
>>>
>>>> Hi,
>>>>
>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>> relationship and ProductRegistry set as transient.
>>>>
>>>> I create a new Product and set it's eContainer as not null
>>>> and then add this Product element into HibernateResourse's
>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>
>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>> to make the isResolveProxy() return true, I could stop this
>>>> removal.
>>>>
>>>> Do I need to set something in hibernate.hbm.xml?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>
>
>
> Attachment decoded: untitled-2.txt
> --------------040705060809080707090006
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html;charset=ISO-8859-1"
> http-equiv="Content-Type">
> </head>
> <body bgcolor="#ffffff" text="#000000">
> Anthony,<br>
> <br>
> I'm not sure I completely follow what you are asking (container is set
> as transient implies you don't want to serialize it), but in the XMI
> serialization, to serialize a reference to the container, you need to
> define a non-transient container feature (i.e., an EReference that's
> the eOpposite of the containment feature).<br>
> <br>
> <br>
> Anthony wrote:
> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
> type="cite">
> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in
> <a class="moz-txt-link-freetext"
> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
> @build.eclipse.org:
>
> Merks,
>
> Thanks.
>
> So if the container is set as transient, how to persist the
> container's element ?
>
>
>
> Anthony
>
>
>
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">Anthony,
>
> This sounds like expected behavior. For non-proxy resolving
> </pre>
> </blockquote>
> <pre wrap=""><!---->containment
> </pre>
> <blockquote type="cite">
> <pre wrap="">reference (EReference.isResolveProxies == true),
> eContainer and
> eDirectResource mutually exclusive, i.e., you can't have an EObject
> container and be contained directly by a resource's getContents. Only
> for proxy resolving containment is it possible to put a "child" in to
> </pre>
> </blockquote>
> <pre wrap=""><!---->a
> </pre>
> <blockquote type="cite">
> <pre wrap="">separate resource. Note that if Products parent is
> already in a
> resource then product.eResource() will be non-null, and there is no
> </pre>
> </blockquote>
> <pre wrap=""><!---->need
> </pre>
> <blockquote type="cite">
> <pre wrap="">to put the Product directly in the resource since
> it's indirectly
> contained in the resource by virtue of the parent being contained in a
> resource.
>
> Anthony wrote:
> </pre>
> <blockquote type="cite">
> <pre wrap="">Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>
>
> </pre>
> </blockquote>
> </blockquote>
> <pre wrap=""><!---->
> </pre>
> </blockquote>
> <br>
> </body>
> </html>
>
> Attachment decoded: untitled-3.htm
> --------------040705060809080707090006--
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83273 is a reply to message #83257] Fri, 11 May 2007 12:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------010208080105080404000706
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anthony,

There isn't actually a question in your note so I'm not sure if you are
trying to ask one...

Do you have explicit EReferences for both ends of the relationship? Have
you made the container side non-transient? And have you made both ends
proxy resolving?


Anthony wrote:
> Merks,
>
> Actually I used Teneo to save my model into DB.
>
> Let me introduce the picture:
>
> When the first time the model is created , the only one
> ProductRegistry element is created and saved.
>
> And then when user click the Product node in UI, I need to
> show a table to list the products.
>
> Because the products collection could be really huge, so I choose
> to change them to many-to-one's (so only persist the reference from the
> child to the parent) and load the one-to-many relation (parent to child)
> on demand through an explicit query (make the many-reference from the
> parent to the child transient). Adding to the parent is then done by
> setting the parent feature in the child.
>
>
>
> Anthony
>
>
>
>
>
>
>> Anthony,
>>
>> I'm not sure I completely follow what you are asking (container is set
>> as transient implies you don't want to serialize it), but in the XMI
>> serialization, to serialize a reference to the container, you need to
>> define a non-transient container feature (i.e., an EReference that's
>> the eOpposite of the containment feature).
>>
>>
>> Anthony wrote:
>>
>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>> @build.eclipse.org:
>>>
>>> Merks,
>>>
>>> Thanks.
>>>
>>> So if the container is set as transient, how to persist the
>>> container's element ?
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>>
>>>> Anthony,
>>>>
>>>> This sounds like expected behavior. For non-proxy resolving
>>>>
>>>>
>>> containment
>>>
>>>
>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>> container and be contained directly by a resource's getContents.
>>>> Only for proxy resolving containment is it possible to put a "child"
>>>> in to
>>>>
>>>>
>>> a
>>>
>>>
>>>> separate resource. Note that if Products parent is already in a
>>>> resource then product.eResource() will be non-null, and there is no
>>>>
>>>>
>>> need
>>>
>>>
>>>> to put the Product directly in the resource since it's indirectly
>>>> contained in the resource by virtue of the parent being contained in
>>>> a resource.
>>>>
>>>> Anthony wrote:
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>> relationship and ProductRegistry set as transient.
>>>>>
>>>>> I create a new Product and set it's eContainer as not null
>>>>> and then add this Product element into HibernateResourse's
>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>
>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>> to make the isResolveProxy() return true, I could stop this
>>>>> removal.
>>>>>
>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>> Attachment decoded: untitled-2.txt
>> --------------040705060809080707090006
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>> <head>
>> <meta content="text/html;charset=ISO-8859-1"
>> http-equiv="Content-Type">
>> </head>
>> <body bgcolor="#ffffff" text="#000000">
>> Anthony,<br>
>> <br>
>> I'm not sure I completely follow what you are asking (container is set
>> as transient implies you don't want to serialize it), but in the XMI
>> serialization, to serialize a reference to the container, you need to
>> define a non-transient container feature (i.e., an EReference that's
>> the eOpposite of the containment feature).<br>
>> <br>
>> <br>
>> Anthony wrote:
>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>> type="cite">
>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in
>> <a class="moz-txt-link-freetext"
>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>> @build.eclipse.org:
>>
>> Merks,
>>
>> Thanks.
>>
>> So if the container is set as transient, how to persist the
>> container's element ?
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Anthony,
>>
>> This sounds like expected behavior. For non-proxy resolving
>> </pre>
>> </blockquote>
>> <pre wrap=""><!---->containment
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">reference (EReference.isResolveProxies == true),
>> eContainer and
>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>> container and be contained directly by a resource's getContents. Only
>> for proxy resolving containment is it possible to put a "child" in to
>> </pre>
>> </blockquote>
>> <pre wrap=""><!---->a
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">separate resource. Note that if Products parent is
>> already in a
>> resource then product.eResource() will be non-null, and there is no
>> </pre>
>> </blockquote>
>> <pre wrap=""><!---->need
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">to put the Product directly in the resource since
>> it's indirectly
>> contained in the resource by virtue of the parent being contained in a
>> resource.
>>
>> Anthony wrote:
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>>
>> </pre>
>> </blockquote>
>> </blockquote>
>> <pre wrap=""><!---->
>> </pre>
>> </blockquote>
>> <br>
>> </body>
>> </html>
>>
>> Attachment decoded: untitled-3.htm
>> --------------040705060809080707090006--
>>
>>
>
>


--------------010208080105080404000706
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Anthony,<br>
<br>
There isn't actually a question in your note so I'm not sure if you are
trying to ask one...<br>
<br>
Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made both
ends proxy resolving?<br>
<br>
<br>
Anthony wrote:
<blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
type="cite">
<pre wrap="">Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I choose
to change them to many-to-one's (so only persist the reference from the
child to the parent) and load the one-to-many relation (parent to child)
on demand through an explicit query (make the many-reference from the
parent to the child transient). Adding to the parent is then done by
setting the parent feature in the child.



Anthony





</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).


Anthony wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony





</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

This sounds like expected behavior. For non-proxy resolving

</pre>
</blockquote>
<pre wrap="">containment

</pre>
<blockquote type="cite">
<pre wrap="">reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents.
Only for proxy resolving containment is it possible to put a "child"
in to

</pre>
</blockquote>
<pre wrap="">a

</pre>
<blockquote type="cite">
<pre wrap="">separate resource. Note that if Products parent is already in a
resource then product.eResource() will be non-null, and there is no

</pre>
</blockquote>
<pre wrap="">need

</pre>
<blockquote type="cite">
<pre wrap="">to put the Product directly in the resource since it's indirectly
contained in the resource by virtue of the parent being contained in
a resource.

Anthony wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony





</pre>
</blockquote>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap="">
Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FC81B5A375AnthonyLee@206.191.52.34">"midXns990FC81B5A375AnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in
&lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;containment
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies == true),
eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents. Only
for proxy resolving containment is it possible to put a "child" in to
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;a
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products parent is
already in a
resource then product.eResource() will be non-null, and there is no
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;need
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource since
it's indirectly
contained in the resource by virtue of the parent being contained in a
resource.

Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------040705060809080707090006--

</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------010208080105080404000706--
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83290 is a reply to message #83273] Fri, 11 May 2007 12:46 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Merks,

Yes, both ends has explicit EReferences and the container side is
transient, both ends are not proxy resolving.


The question is :

When I try to add new element which has set eContainer into resource
contents , the eContainer is removed by inverseAdd(). So I don't know
how to save these elements.


Anthony


> Anthony,
>
> There isn't actually a question in your note so I'm not sure if you
> are trying to ask one...
>
> Do you have explicit EReferences for both ends of the relationship?
> Have you made the container side non-transient? And have you made both
> ends proxy resolving?
>
>
> Anthony wrote:
>> Merks,
>>
>> Actually I used Teneo to save my model into DB.
>>
>> Let me introduce the picture:
>>
>> When the first time the model is created , the only one
>> ProductRegistry element is created and saved.
>>
>> And then when user click the Product node in UI, I need to
>> show a table to list the products.
>>
>> Because the products collection could be really huge, so I
>> choose
>> to change them to many-to-one's (so only persist the reference from
>> the child to the parent) and load the one-to-many relation (parent to
>> child) on demand through an explicit query (make the many-reference
>> from the parent to the child transient). Adding to the parent is then
>> done by setting the parent feature in the child.
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>>
>>
>>> Anthony,
>>>
>>> I'm not sure I completely follow what you are asking (container is
>>> set as transient implies you don't want to serialize it), but in the
>>> XMI serialization, to serialize a reference to the container, you
>>> need to define a non-transient container feature (i.e., an
>>> EReference that's the eOpposite of the containment feature).
>>>
>>>
>>> Anthony wrote:
>>>
>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>> @build.eclipse.org:
>>>>
>>>> Merks,
>>>>
>>>> Thanks.
>>>>
>>>> So if the container is set as transient, how to persist the
>>>> container's element ?
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Anthony,
>>>>>
>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>
>>>>>
>>>> containment
>>>>
>>>>
>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>> EObject container and be contained directly by a resource's
>>>>> getContents. Only for proxy resolving containment is it possible
>>>>> to put a "child" in to
>>>>>
>>>>>
>>>> a
>>>>
>>>>
>>>>> separate resource. Note that if Products parent is already in a
>>>>> resource then product.eResource() will be non-null, and there is
>>>>> no
>>>>>
>>>>>
>>>> need
>>>>
>>>>
>>>>> to put the Product directly in the resource since it's indirectly
>>>>> contained in the resource by virtue of the parent being contained
>>>>> in a resource.
>>>>>
>>>>> Anthony wrote:
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>> relationship and ProductRegistry set as transient.
>>>>>>
>>>>>> I create a new Product and set it's eContainer as not null
>>>>>> and then add this Product element into HibernateResourse's
>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>
>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>> removal.
>>>>>>
>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>> Attachment decoded: untitled-2.txt
>>> --------------040705060809080707090006
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>> <html>
>>> <head>
>>> <meta content="text/html;charset=ISO-8859-1"
>>> http-equiv="Content-Type">
>>> </head>
>>> <body bgcolor="#ffffff" text="#000000">
>>> Anthony,<br>
>>> <br>
>>> I'm not sure I completely follow what you are asking (container is
>>> set as transient implies you don't want to serialize it), but in the
>>> XMI serialization, to serialize a reference to the container, you
>>> need to define a non-transient container feature (i.e., an
>>> EReference that's the eOpposite of the containment feature).<br>
>>> <br>
>>> <br>
>>> Anthony wrote:
>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>> type="cite">
>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote
>>> in <a class="moz-txt-link-freetext"
>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>> @build.eclipse.org:
>>>
>>> Merks,
>>>
>>> Thanks.
>>>
>>> So if the container is set as transient, how to persist the
>>> container's element ?
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Anthony,
>>>
>>> This sounds like expected behavior. For non-proxy resolving
>>> </pre>
>>> </blockquote>
>>> <pre wrap=""><!---->containment
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>> eContainer and
>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>> container and be contained directly by a resource's getContents.
>>> Only for proxy resolving containment is it possible to put a "child"
>>> in to
>>> </pre>
>>> </blockquote>
>>> <pre wrap=""><!---->a
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">separate resource. Note that if Products parent is
>>> already in a
>>> resource then product.eResource() will be non-null, and there is no
>>> </pre>
>>> </blockquote>
>>> <pre wrap=""><!---->need
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">to put the Product directly in the resource since
>>> it's indirectly
>>> contained in the resource by virtue of the parent being contained in
>>> a resource.
>>>
>>> Anthony wrote:
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Hi,
>>>
>>> In my EMF model , Product and ProductRegistry has many-To-one
>>> relationship and ProductRegistry set as transient.
>>>
>>> I create a new Product and set it's eContainer as not null
>>> and then add this Product element into HibernateResourse's
>>> contents, in inverseAdd() ,the eContainer is removed.
>>>
>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>> to make the isResolveProxy() return true, I could stop this removal.
>>>
>>> Do I need to set something in hibernate.hbm.xml?
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>> </pre>
>>> </blockquote>
>>> </blockquote>
>>> <pre wrap=""><!---->
>>> </pre>
>>> </blockquote>
>>> <br>
>>> </body>
>>> </html>
>>>
>>> Attachment decoded: untitled-3.htm
>>> --------------040705060809080707090006--
>>>
>>>
>>
>>
>
>
> Attachment decoded: untitled-2.txt
> --------------010208080105080404000706
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html;charset=ISO-8859-1"
> http-equiv="Content-Type">
> </head>
> <body bgcolor="#ffffff" text="#000000">
> Anthony,<br>
> <br>
> There isn't actually a question in your note so I'm not sure if you
> are trying to ask one...<br>
> <br>
> Do you have explicit EReferences for both ends of the relationship?
> Have you made the container side non-transient? And have you made both
> ends proxy resolving?<br>
> <br>
> <br>
> Anthony wrote:
> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
> type="cite">
> <pre wrap="">Merks,
>
> Actually I used Teneo to save my model into DB.
>
> Let me introduce the picture:
>
> When the first time the model is created , the only one
> ProductRegistry element is created and saved.
>
> And then when user click the Product node in UI, I need to
> show a table to list the products.
>
> Because the products collection could be really huge, so I
> choose
> to change them to many-to-one's (so only persist the reference from
> the child to the parent) and load the one-to-many relation (parent to
> child) on demand through an explicit query (make the many-reference
> from the parent to the child transient). Adding to the parent is then
> done by setting the parent feature in the child.
>
>
>
> Anthony
>
>
>
>
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">Anthony,
>
> I'm not sure I completely follow what you are asking (container is set
> as transient implies you don't want to serialize it), but in the XMI
> serialization, to serialize a reference to the container, you need to
> define a non-transient container feature (i.e., an EReference that's
> the eOpposite of the containment feature).
>
>
> Anthony wrote:
> </pre>
> <blockquote type="cite">
> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
> wrote in <a class="moz-txt-link-freetext"
> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
> @build.eclipse.org:
>
> Merks,
>
> Thanks.
>
> So if the container is set as transient, how to persist the
> container's element ?
>
>
>
> Anthony
>
>
>
>
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">Anthony,
>
> This sounds like expected behavior. For non-proxy resolving
>
> </pre>
> </blockquote>
> <pre wrap="">containment
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">reference (EReference.isResolveProxies == true),
> eContainer and
> eDirectResource mutually exclusive, i.e., you can't have an EObject
> container and be contained directly by a resource's getContents.
> Only for proxy resolving containment is it possible to put a "child"
> in to
>
> </pre>
> </blockquote>
> <pre wrap="">a
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">separate resource. Note that if Products parent
> is already in a
> resource then product.eResource() will be non-null, and there is no
>
> </pre>
> </blockquote>
> <pre wrap="">need
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">to put the Product directly in the resource since
> it's indirectly
> contained in the resource by virtue of the parent being contained in
> a resource.
>
> Anthony wrote:
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this
> removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>
>
>
> </pre>
> </blockquote>
> </blockquote>
> <pre wrap="">
> </pre>
> </blockquote>
> <pre wrap="">
> Attachment decoded: untitled-2.txt
> --------------040705060809080707090006
> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
> &lt;html&gt;
> &lt;head&gt;
> &lt;meta content="text/html;charset=ISO-8859-1"
> http-equiv="Content-Type"&gt;
> &lt;/head&gt;
> &lt;body bgcolor="#ffffff" text="#000000"&gt;
> Anthony,&lt;br&gt;
> &lt;br&gt;
> I'm not sure I completely follow what you are asking (container is set
> as transient implies you don't want to serialize it), but in the XMI
> serialization, to serialize a reference to the container, you need to
> define a non-transient container feature (i.e., an EReference that's
> the eOpposite of the containment feature).&lt;br&gt;
> &lt;br&gt;
> &lt;br&gt;
> Anthony wrote:
> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
> href="mailto:midXns990FC81B5A375AnthonyLee@
206.191.52.34">"midXns990FC8
> 1B5A375AnthonyLee@206.191.52.34"</a>
> type="cite"&gt;
> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
> href=<a class="moz-txt-link-rfc2396E"
> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
&amp;
> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
> class="moz-txt-link-freetext" href=<a class="moz-txt-link-rfc2396E"
> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
> class="moz-txt-link-freetext"
> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
> @build.eclipse.org:
>
> Merks,
>
> Thanks.
>
> So if the container is set as transient, how to persist the
> container's element ?
>
>
>
> Anthony
>
>
>
>
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;Anthony,
>
> This sounds like expected behavior. For non-proxy resolving
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;pre wrap=""&gt;&lt;!----&gt;containment
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
> true), eContainer and
> eDirectResource mutually exclusive, i.e., you can't have an EObject
> container and be contained directly by a resource's getContents. Only
> for proxy resolving containment is it possible to put a "child" in to
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;pre wrap=""&gt;&lt;!----&gt;a
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;separate resource. Note that if Products
> parent is already in a
> resource then product.eResource() will be non-null, and there is no
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;pre wrap=""&gt;&lt;!----&gt;need
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;to put the Product directly in the resource
> since it's indirectly
> contained in the resource by virtue of the parent being contained in a
> resource.
>
> Anthony wrote:
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>
>
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;/blockquote&gt;
> &lt;pre wrap=""&gt;&lt;!----&gt;
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;br&gt;
> &lt;/body&gt;
> &lt;/html&gt;
>
> Attachment decoded: untitled-3.htm
> --------------040705060809080707090006--
>
> </pre>
> </blockquote>
> <pre wrap=""><!---->
> </pre>
> </blockquote>
> <br>
> </body>
> </html>
>
> Attachment decoded: untitled-3.htm
> --------------010208080105080404000706--
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83310 is a reply to message #83290] Fri, 11 May 2007 12:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------010504090600060301080902
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anthony,

If you really need the parent and the child to be in separate resources
then you must make both ends proxy resolving, i.e., set
EReference.isResolveProxies to true. And I'm not sure how Teneo
handles it, but I imagine that a transient feature will not be
persisted, so probably you want to make the container side non-transient...


Anthony wrote:
> Merks,
>
> Yes, both ends has explicit EReferences and the container side is
> transient, both ends are not proxy resolving.
>
>
> The question is :
>
> When I try to add new element which has set eContainer into resource
> contents , the eContainer is removed by inverseAdd(). So I don't know
> how to save these elements.
>
>
> Anthony
>
>
>
>> Anthony,
>>
>> There isn't actually a question in your note so I'm not sure if you
>> are trying to ask one...
>>
>> Do you have explicit EReferences for both ends of the relationship?
>> Have you made the container side non-transient? And have you made both
>> ends proxy resolving?
>>
>>
>> Anthony wrote:
>>
>>> Merks,
>>>
>>> Actually I used Teneo to save my model into DB.
>>>
>>> Let me introduce the picture:
>>>
>>> When the first time the model is created , the only one
>>> ProductRegistry element is created and saved.
>>>
>>> And then when user click the Product node in UI, I need to
>>> show a table to list the products.
>>>
>>> Because the products collection could be really huge, so I
>>> choose
>>> to change them to many-to-one's (so only persist the reference from
>>> the child to the parent) and load the one-to-many relation (parent to
>>> child) on demand through an explicit query (make the many-reference
>>> from the parent to the child transient). Adding to the parent is then
>>> done by setting the parent feature in the child.
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>> Anthony,
>>>>
>>>> I'm not sure I completely follow what you are asking (container is
>>>> set as transient implies you don't want to serialize it), but in the
>>>> XMI serialization, to serialize a reference to the container, you
>>>> need to define a non-transient container feature (i.e., an
>>>> EReference that's the eOpposite of the containment feature).
>>>>
>>>>
>>>> Anthony wrote:
>>>>
>>>>
>>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>>> @build.eclipse.org:
>>>>>
>>>>> Merks,
>>>>>
>>>>> Thanks.
>>>>>
>>>>> So if the container is set as transient, how to persist the
>>>>> container's element ?
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Anthony,
>>>>>>
>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>
>>>>>>
>>>>>>
>>>>> containment
>>>>>
>>>>>
>>>>>
>>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>> EObject container and be contained directly by a resource's
>>>>>> getContents. Only for proxy resolving containment is it possible
>>>>>> to put a "child" in to
>>>>>>
>>>>>>
>>>>>>
>>>>> a
>>>>>
>>>>>
>>>>>
>>>>>> separate resource. Note that if Products parent is already in a
>>>>>> resource then product.eResource() will be non-null, and there is
>>>>>> no
>>>>>>
>>>>>>
>>>>>>
>>>>> need
>>>>>
>>>>>
>>>>>
>>>>>> to put the Product directly in the resource since it's indirectly
>>>>>> contained in the resource by virtue of the parent being contained
>>>>>> in a resource.
>>>>>>
>>>>>> Anthony wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>
>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>
>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>> removal.
>>>>>>>
>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>> Attachment decoded: untitled-2.txt
>>>> --------------040705060809080707090006
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>> <html>
>>>> <head>
>>>> <meta content="text/html;charset=ISO-8859-1"
>>>> http-equiv="Content-Type">
>>>> </head>
>>>> <body bgcolor="#ffffff" text="#000000">
>>>> Anthony,<br>
>>>> <br>
>>>> I'm not sure I completely follow what you are asking (container is
>>>> set as transient implies you don't want to serialize it), but in the
>>>> XMI serialization, to serialize a reference to the container, you
>>>> need to define a non-transient container feature (i.e., an
>>>> EReference that's the eOpposite of the containment feature).<br>
>>>> <br>
>>>> <br>
>>>> Anthony wrote:
>>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>>> type="cite">
>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote
>>>> in <a class="moz-txt-link-freetext"
>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>> @build.eclipse.org:
>>>>
>>>> Merks,
>>>>
>>>> Thanks.
>>>>
>>>> So if the container is set as transient, how to persist the
>>>> container's element ?
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Anthony,
>>>>
>>>> This sounds like expected behavior. For non-proxy resolving
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap=""><!---->containment
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>>> eContainer and
>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>> container and be contained directly by a resource's getContents.
>>>> Only for proxy resolving containment is it possible to put a "child"
>>>> in to
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap=""><!---->a
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">separate resource. Note that if Products parent is
>>>> already in a
>>>> resource then product.eResource() will be non-null, and there is no
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap=""><!---->need
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">to put the Product directly in the resource since
>>>> it's indirectly
>>>> contained in the resource by virtue of the parent being contained in
>>>> a resource.
>>>>
>>>> Anthony wrote:
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Hi,
>>>>
>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>> relationship and ProductRegistry set as transient.
>>>>
>>>> I create a new Product and set it's eContainer as not null
>>>> and then add this Product element into HibernateResourse's
>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>
>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>> to make the isResolveProxy() return true, I could stop this removal.
>>>>
>>>> Do I need to set something in hibernate.hbm.xml?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> </blockquote>
>>>> <pre wrap=""><!---->
>>>> </pre>
>>>> </blockquote>
>>>> <br>
>>>> </body>
>>>> </html>
>>>>
>>>> Attachment decoded: untitled-3.htm
>>>> --------------040705060809080707090006--
>>>>
>>>>
>>>>
>>>
>>>
>> Attachment decoded: untitled-2.txt
>> --------------010208080105080404000706
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>> <head>
>> <meta content="text/html;charset=ISO-8859-1"
>> http-equiv="Content-Type">
>> </head>
>> <body bgcolor="#ffffff" text="#000000">
>> Anthony,<br>
>> <br>
>> There isn't actually a question in your note so I'm not sure if you
>> are trying to ask one...<br>
>> <br>
>> Do you have explicit EReferences for both ends of the relationship?
>> Have you made the container side non-transient? And have you made both
>> ends proxy resolving?<br>
>> <br>
>> <br>
>> Anthony wrote:
>> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
>> type="cite">
>> <pre wrap="">Merks,
>>
>> Actually I used Teneo to save my model into DB.
>>
>> Let me introduce the picture:
>>
>> When the first time the model is created , the only one
>> ProductRegistry element is created and saved.
>>
>> And then when user click the Product node in UI, I need to
>> show a table to list the products.
>>
>> Because the products collection could be really huge, so I
>> choose
>> to change them to many-to-one's (so only persist the reference from
>> the child to the parent) and load the one-to-many relation (parent to
>> child) on demand through an explicit query (make the many-reference
>> from the parent to the child transient). Adding to the parent is then
>> done by setting the parent feature in the child.
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Anthony,
>>
>> I'm not sure I completely follow what you are asking (container is set
>> as transient implies you don't want to serialize it), but in the XMI
>> serialization, to serialize a reference to the container, you need to
>> define a non-transient container feature (i.e., an EReference that's
>> the eOpposite of the containment feature).
>>
>>
>> Anthony wrote:
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>> wrote in <a class="moz-txt-link-freetext"
>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>> @build.eclipse.org:
>>
>> Merks,
>>
>> Thanks.
>>
>> So if the container is set as transient, how to persist the
>> container's element ?
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Anthony,
>>
>> This sounds like expected behavior. For non-proxy resolving
>>
>> </pre>
>> </blockquote>
>> <pre wrap="">containment
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">reference (EReference.isResolveProxies == true),
>> eContainer and
>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>> container and be contained directly by a resource's getContents.
>> Only for proxy resolving containment is it possible to put a "child"
>> in to
>>
>> </pre>
>> </blockquote>
>> <pre wrap="">a
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">separate resource. Note that if Products parent
>> is already in a
>> resource then product.eResource() will be non-null, and there is no
>>
>> </pre>
>> </blockquote>
>> <pre wrap="">need
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">to put the Product directly in the resource since
>> it's indirectly
>> contained in the resource by virtue of the parent being contained in
>> a resource.
>>
>> Anthony wrote:
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this
>> removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>>
>>
>> </pre>
>> </blockquote>
>> </blockquote>
>> <pre wrap="">
>> </pre>
>> </blockquote>
>> <pre wrap="">
>> Attachment decoded: untitled-2.txt
>> --------------040705060809080707090006
>> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
>> &lt;html&gt;
>> &lt;head&gt;
>> &lt;meta content="text/html;charset=ISO-8859-1"
>> http-equiv="Content-Type"&gt;
>> &lt;/head&gt;
>> &lt;body bgcolor="#ffffff" text="#000000"&gt;
>> Anthony,&lt;br&gt;
>> &lt;br&gt;
>> I'm not sure I completely follow what you are asking (container is set
>> as transient implies you don't want to serialize it), but in the XMI
>> serialization, to serialize a reference to the container, you need to
>> define a non-transient container feature (i.e., an EReference that's
>> the eOpposite of the containment feature).&lt;br&gt;
>> &lt;br&gt;
>> &lt;br&gt;
>> Anthony wrote:
>> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
>> href="mailto:midXns990FC81B5A375AnthonyLee@
>>
> 206.191.52.34">"midXns990FC8
>
>> 1B5A375AnthonyLee@206.191.52.34"</a>
>> type="cite"&gt;
>> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
>> href=<a class="moz-txt-link-rfc2396E"
>> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
>>
> &amp;
>
>> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
>> class="moz-txt-link-freetext" href=<a class="moz-txt-link-rfc2396E"
>> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
>> class="moz-txt-link-freetext"
>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
>> @build.eclipse.org:
>>
>> Merks,
>>
>> Thanks.
>>
>> So if the container is set as transient, how to persist the
>> container's element ?
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;Anthony,
>>
>> This sounds like expected behavior. For non-proxy resolving
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;pre wrap=""&gt;&lt;!----&gt;containment
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
>> true), eContainer and
>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>> container and be contained directly by a resource's getContents. Only
>> for proxy resolving containment is it possible to put a "child" in to
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;pre wrap=""&gt;&lt;!----&gt;a
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;separate resource. Note that if Products
>> parent is already in a
>> resource then product.eResource() will be non-null, and there is no
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;pre wrap=""&gt;&lt;!----&gt;need
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;to put the Product directly in the resource
>> since it's indirectly
>> contained in the resource by virtue of the parent being contained in a
>> resource.
>>
>> Anthony wrote:
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>>
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;/blockquote&gt;
>> &lt;pre wrap=""&gt;&lt;!----&gt;
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;br&gt;
>> &lt;/body&gt;
>> &lt;/html&gt;
>>
>> Attachment decoded: untitled-3.htm
>> --------------040705060809080707090006--
>>
>> </pre>
>> </blockquote>
>> <pre wrap=""><!---->
>> </pre>
>> </blockquote>
>> <br>
>> </body>
>> </html>
>>
>> Attachment decoded: untitled-3.htm
>> --------------010208080105080404000706--
>>
>>
>
>


--------------010504090600060301080902
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Anthony,<br>
<br>
If you really need the parent and the child to be in separate resources
then you must make both ends proxy resolving, i.e., set
EReference.isResolveProxies to true. &nbsp; And I'm not sure how Teneo
handles it, but I imagine that a transient feature will not be
persisted, so probably you want to make the container side
non-transient...<br>
<br>
<br>
Anthony wrote:
<blockquote cite="midXns990FD32108BCCAnthonyLee@206.191.52.34"
type="cite">
<pre wrap="">Merks,

Yes, both ends has explicit EReferences and the container side is
transient, both ends are not proxy resolving.


The question is :

When I try to add new element which has set eContainer into resource
contents , the eContainer is removed by inverseAdd(). So I don't know
how to save these elements.


Anthony


</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

There isn't actually a question in your note so I'm not sure if you
are trying to ask one...

Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made both
ends proxy resolving?


Anthony wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I
choose
to change them to many-to-one's (so only persist the reference from
the child to the parent) and load the one-to-many relation (parent to
child) on demand through an explicit query (make the many-reference
from the parent to the child transient). Adding to the parent is then
done by setting the parent feature in the child.



Anthony






</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

I'm not sure I completely follow what you are asking (container is
set as transient implies you don't want to serialize it), but in the
XMI serialization, to serialize a reference to the container, you
need to define a non-transient container feature (i.e., an
EReference that's the eOpposite of the containment feature).


Anthony wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony






</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

This sounds like expected behavior. For non-proxy resolving


</pre>
</blockquote>
<pre wrap="">containment


</pre>
<blockquote type="cite">
<pre wrap="">reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an
EObject container and be contained directly by a resource's
getContents. Only for proxy resolving containment is it possible
to put a "child" in to


</pre>
</blockquote>
<pre wrap="">a


</pre>
<blockquote type="cite">
<pre wrap="">separate resource. Note that if Products parent is already in a
resource then product.eResource() will be non-null, and there is
no


</pre>
</blockquote>
<pre wrap="">need


</pre>
<blockquote type="cite">
<pre wrap="">to put the Product directly in the resource since it's indirectly
contained in the resource by virtue of the parent being contained
in a resource.

Anthony wrote:


</pre>
<blockquote type="cite">
<pre wrap="">Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony






</pre>
</blockquote>
</blockquote>
<pre wrap="">

</pre>
</blockquote>
<pre wrap="">Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
I'm not sure I completely follow what you are asking (container is
set as transient implies you don't want to serialize it), but in the
XMI serialization, to serialize a reference to the container, you
need to define a non-transient container feature (i.e., an
EReference that's the eOpposite of the containment feature).&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FC81B5A375AnthonyLee@206.191.52.34">"midXns990FC81B5A375AnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote
in &lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;containment
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies == true),
eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents.
Only for proxy resolving containment is it possible to put a "child"
in to
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;a
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products parent is
already in a
resource then product.eResource() will be non-null, and there is no
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;need
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource since
it's indirectly
contained in the resource by virtue of the parent being contained in
a resource.

Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------040705060809080707090006--


</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap="">
Attachment decoded: untitled-2.txt
--------------010208080105080404000706
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
There isn't actually a question in your note so I'm not sure if you
are trying to ask one...&lt;br&gt;
&lt;br&gt;
Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made both
ends proxy resolving?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FCFB6F89BDAnthonyLee@206.191.52.34">"midXns990FCFB6F89BDAnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I
choose
to change them to many-to-one's (so only persist the reference from
the child to the parent) and load the one-to-many relation (parent to
child) on demand through an explicit query (make the many-reference
from the parent to the child transient). Adding to the parent is then
done by setting the parent feature in the child.



Anthony





&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).


Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt;
wrote in &lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony





&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;containment

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies == true),
eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents.
Only for proxy resolving containment is it possible to put a "child"
in to

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;a

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products parent
is already in a
resource then product.eResource() will be non-null, and there is no

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;need

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource since
it's indirectly
contained in the resource by virtue of the parent being contained in
a resource.

Anthony wrote:

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony





&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;
Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body bgcolor="#ffffff" text="#000000"&amp;gt;
Anthony,&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
Anthony wrote:
&amp;lt;blockquote cite=&lt;a class="moz-txt-link-rfc2396E"
href="<a class="moz-txt-link-freetext" href="mailto:midXns990FC81B5A375AnthonyLee@">mailto:midXns990FC81B5A375AnthonyLee@ </a>
</pre>
</blockquote>
<pre wrap=""><!---->206.191.52.34"&gt;"midXns990FC8
</pre>
<blockquote type="cite">
<pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:1B5A375AnthonyLee@206.191.52.34">1B5A375AnthonyLee@206.191.52.34</a>"&lt;/a&gt;
type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Ed Merks &amp;lt;a class="moz-txt-link-rfc2396E"
href=&lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca..ibm.com">"mailto:merks@ca.ibm.com"</a>&lt;/a&gt;&amp;gt;
</pre>
</blockquote>
<pre wrap=""><!---->&amp;amp;
</pre>
<blockquote type="cite">
<pre wrap=""> <a class="moz-txt-link-abbreviated" href="mailto:lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt">lt;merks@ca.ibm.com&amp;amp;gt;&amp;lt;/a&amp;gt</a>; wrote in &amp;lt;a
class="moz-txt-link-freetext" href=&lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&lt;/a&gt;&amp;gt;&lt;a
class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;&amp;lt;/a&amp;gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;containment
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;reference (EReference.isResolveProxies ==
true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents. Only
for proxy resolving containment is it possible to put a "child" in to
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;a
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;separate resource. Note that if Products
parent is already in a
resource then product.eResource() will be non-null, and there is no
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;need
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;to put the Product directly in the resource
since it's indirectly
contained in the resource by virtue of the parent being contained in a
resource.

Anthony wrote:
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

Attachment decoded: untitled-3.htm
--------------040705060809080707090006--

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------010208080105080404000706--

</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------010504090600060301080902--
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83325 is a reply to message #83310] Fri, 11 May 2007 14:12 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
I am not sure but does your first remark:

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

not already solve this issue? It seems like what Ed suggests.

gr. Martin

Ed Merks wrote:
> Anthony,
>
> If you really need the parent and the child to be in separate resources
> then you must make both ends proxy resolving, i.e., set
> EReference.isResolveProxies to true. And I'm not sure how Teneo
> handles it, but I imagine that a transient feature will not be
> persisted, so probably you want to make the container side non-transient...
>
>
> Anthony wrote:
>> Merks,
>>
>> Yes, both ends has explicit EReferences and the container side is
>> transient, both ends are not proxy resolving.
>>
>>
>> The question is :
>>
>> When I try to add new element which has set eContainer into resource
>> contents , the eContainer is removed by inverseAdd(). So I don't know
>> how to save these elements.
>>
>>
>> Anthony
>>
>>
>>
>>> Anthony,
>>>
>>> There isn't actually a question in your note so I'm not sure if you
>>> are trying to ask one...
>>>
>>> Do you have explicit EReferences for both ends of the relationship?
>>> Have you made the container side non-transient? And have you made both
>>> ends proxy resolving?
>>>
>>>
>>> Anthony wrote:
>>>
>>>> Merks,
>>>>
>>>> Actually I used Teneo to save my model into DB.
>>>>
>>>> Let me introduce the picture:
>>>>
>>>> When the first time the model is created , the only one
>>>> ProductRegistry element is created and saved.
>>>>
>>>> And then when user click the Product node in UI, I need to
>>>> show a table to list the products.
>>>>
>>>> Because the products collection could be really huge, so I
>>>> choose
>>>> to change them to many-to-one's (so only persist the reference from
>>>> the child to the parent) and load the one-to-many relation (parent to
>>>> child) on demand through an explicit query (make the many-reference
>>>> from the parent to the child transient). Adding to the parent is then
>>>> done by setting the parent feature in the child.
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Anthony,
>>>>>
>>>>> I'm not sure I completely follow what you are asking (container is
>>>>> set as transient implies you don't want to serialize it), but in the
>>>>> XMI serialization, to serialize a reference to the container, you
>>>>> need to define a non-transient container feature (i.e., an
>>>>> EReference that's the eOpposite of the containment feature).
>>>>>
>>>>>
>>>>> Anthony wrote:
>>>>>
>>>>>
>>>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>>>> @build.eclipse.org:
>>>>>>
>>>>>> Merks,
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> So if the container is set as transient, how to persist the
>>>>>> container's element ?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Anthony,
>>>>>>>
>>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> containment
>>>>>>
>>>>>>
>>>>>>
>>>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>>> EObject container and be contained directly by a resource's
>>>>>>> getContents. Only for proxy resolving containment is it possible
>>>>>>> to put a "child" in to
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> a
>>>>>>
>>>>>>
>>>>>>
>>>>>>> separate resource. Note that if Products parent is already in a
>>>>>>> resource then product.eResource() will be non-null, and there is
>>>>>>> no
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> need
>>>>>>
>>>>>>
>>>>>>
>>>>>>> to put the Product directly in the resource since it's indirectly
>>>>>>> contained in the resource by virtue of the parent being contained
>>>>>>> in a resource.
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>>
>>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>>
>>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>>> removal.
>>>>>>>>
>>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> Attachment decoded: untitled-2.txt
>>>>> --------------040705060809080707090006
>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>>> <html>
>>>>> <head>
>>>>> <meta content="text/html;charset=ISO-8859-1"
>>>>> http-equiv="Content-Type">
>>>>> </head>
>>>>> <body bgcolor="#ffffff" text="#000000">
>>>>> Anthony,<br>
>>>>> <br>
>>>>> I'm not sure I completely follow what you are asking (container is
>>>>> set as transient implies you don't want to serialize it), but in the
>>>>> XMI serialization, to serialize a reference to the container, you
>>>>> need to define a non-transient container feature (i.e., an
>>>>> EReference that's the eOpposite of the containment feature).<br>
>>>>> <br>
>>>>> <br>
>>>>> Anthony wrote:
>>>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>>>> type="cite">
>>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote
>>>>> in <a class="moz-txt-link-freetext"
>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>>> @build.eclipse.org:
>>>>>
>>>>> Merks,
>>>>>
>>>>> Thanks.
>>>>>
>>>>> So if the container is set as transient, how to persist the
>>>>> container's element ?
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Anthony,
>>>>>
>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->containment
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>>>> eContainer and
>>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>>> container and be contained directly by a resource's getContents.
>>>>> Only for proxy resolving containment is it possible to put a "child"
>>>>> in to
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->a
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">separate resource. Note that if Products parent is
>>>>> already in a
>>>>> resource then product.eResource() will be non-null, and there is no
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->need
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">to put the Product directly in the resource since
>>>>> it's indirectly
>>>>> contained in the resource by virtue of the parent being contained in
>>>>> a resource.
>>>>>
>>>>> Anthony wrote:
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Hi,
>>>>>
>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>> relationship and ProductRegistry set as transient.
>>>>>
>>>>> I create a new Product and set it's eContainer as not null
>>>>> and then add this Product element into HibernateResourse's
>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>
>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>> to make the isResolveProxy() return true, I could stop this removal.
>>>>>
>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->
>>>>> </pre>
>>>>> </blockquote>
>>>>> <br>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>> Attachment decoded: untitled-3.htm
>>>>> --------------040705060809080707090006--
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> Attachment decoded: untitled-2.txt
>>> --------------010208080105080404000706
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>> <html>
>>> <head>
>>> <meta content="text/html;charset=ISO-8859-1"
>>> http-equiv="Content-Type">
>>> </head>
>>> <body bgcolor="#ffffff" text="#000000">
>>> Anthony,<br>
>>> <br>
>>> There isn't actually a question in your note so I'm not sure if you
>>> are trying to ask one...<br>
>>> <br>
>>> Do you have explicit EReferences for both ends of the relationship?
>>> Have you made the container side non-transient? And have you made both
>>> ends proxy resolving?<br>
>>> <br>
>>> <br>
>>> Anthony wrote:
>>> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
>>> type="cite">
>>> <pre wrap="">Merks,
>>>
>>> Actually I used Teneo to save my model into DB.
>>>
>>> Let me introduce the picture:
>>>
>>> When the first time the model is created , the only one
>>> ProductRegistry element is created and saved.
>>>
>>> And then when user click the Product node in UI, I need to
>>> show a table to list the products.
>>>
>>> Because the products collection could be really huge, so I
>>> choose
>>> to change them to many-to-one's (so only persist the reference from
>>> the child to the parent) and load the one-to-many relation (parent to
>>> child) on demand through an explicit query (make the many-reference
>>> from the parent to the child transient). Adding to the parent is then
>>> done by setting the parent feature in the child.
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Anthony,
>>>
>>> I'm not sure I completely follow what you are asking (container is set
>>> as transient implies you don't want to serialize it), but in the XMI
>>> serialization, to serialize a reference to the container, you need to
>>> define a non-transient container feature (i.e., an EReference that's
>>> the eOpposite of the containment feature).
>>>
>>>
>>> Anthony wrote:
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>> wrote in <a class="moz-txt-link-freetext"
>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>> @build.eclipse.org:
>>>
>>> Merks,
>>>
>>> Thanks.
>>>
>>> So if the container is set as transient, how to persist the
>>> container's element ?
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Anthony,
>>>
>>> This sounds like expected behavior. For non-proxy resolving
>>>
>>> </pre>
>>> </blockquote>
>>> <pre wrap="">containment
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>> eContainer and
>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>> container and be contained directly by a resource's getContents.
>>> Only for proxy resolving containment is it possible to put a "child"
>>> in to
>>>
>>> </pre>
>>> </blockquote>
>>> <pre wrap="">a
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">separate resource. Note that if Products parent
>>> is already in a
>>> resource then product.eResource() will be non-null, and there is no
>>>
>>> </pre>
>>> </blockquote>
>>> <pre wrap="">need
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">to put the Product directly in the resource since
>>> it's indirectly
>>> contained in the resource by virtue of the parent being contained in
>>> a resource.
>>>
>>> Anthony wrote:
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Hi,
>>>
>>> In my EMF model , Product and ProductRegistry has many-To-one
>>> relationship and ProductRegistry set as transient.
>>>
>>> I create a new Product and set it's eContainer as not null
>>> and then add this Product element into HibernateResourse's
>>> contents, in inverseAdd() ,the eContainer is removed.
>>>
>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>> to make the isResolveProxy() return true, I could stop this
>>> removal.
>>>
>>> Do I need to set something in hibernate.hbm.xml?
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>> </pre>
>>> </blockquote>
>>> </blockquote>
>>> <pre wrap="">
>>> </pre>
>>> </blockquote>
>>> <pre wrap="">
>>> Attachment decoded: untitled-2.txt
>>> --------------040705060809080707090006
>>> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
>>> &lt;html&gt;
>>> &lt;head&gt;
>>> &lt;meta content="text/html;charset=ISO-8859-1"
>>> http-equiv="Content-Type"&gt;
>>> &lt;/head&gt;
>>> &lt;body bgcolor="#ffffff" text="#000000"&gt;
>>> Anthony,&lt;br&gt;
>>> &lt;br&gt;
>>> I'm not sure I completely follow what you are asking (container is set
>>> as transient implies you don't want to serialize it), but in the XMI
>>> serialization, to serialize a reference to the container, you need to
>>> define a non-transient container feature (i.e., an EReference that's
>>> the eOpposite of the containment feature).&lt;br&gt;
>>> &lt;br&gt;
>>> &lt;br&gt;
>>> Anthony wrote:
>>> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
>>> href="mailto:midXns990FC81B5A375AnthonyLee@
>>>
>> 206.191.52.34">"midXns990FC8
>>
>>> 1B5A375AnthonyLee@206.191.52.34"</a>
>>> type="cite"&gt;
>>> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
>>> href=<a class="moz-txt-link-rfc2396E"
>>> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
>>>
>> &amp;
>>
>>> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
>>> class="moz-txt-link-freetext" href=<a class="moz-txt-link-rfc2396E"
>>> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
>>> class="moz-txt-link-freetext"
>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
>>> @build.eclipse.org:
>>>
>>> Merks,
>>>
>>> Thanks.
>>>
>>> So if the container is set as transient, how to persist the
>>> container's element ?
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;Anthony,
>>>
>>> This sounds like expected behavior. For non-proxy resolving
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;pre wrap=""&gt;&lt;!----&gt;containment
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
>>> true), eContainer and
>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>> container and be contained directly by a resource's getContents. Only
>>> for proxy resolving containment is it possible to put a "child" in to
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;pre wrap=""&gt;&lt;!----&gt;a
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;separate resource. Note that if Products
>>> parent is already in a
>>> resource then product.eResource() will be non-null, and there is no
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;pre wrap=""&gt;&lt;!----&gt;need
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;to put the Product directly in the resource
>>> since it's indirectly
>>> contained in the resource by virtue of the parent being contained in a
>>> resource.
>>>
>>> Anthony wrote:
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;Hi,
>>>
>>> In my EMF model , Product and ProductRegistry has many-To-one
>>> relationship and ProductRegistry set as transient.
>>>
>>> I create a new Product and set it's eContainer as not null
>>> and then add this Product element into HibernateResourse's
>>> contents, in inverseAdd() ,the eContainer is removed.
>>>
>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>> to make the isResolveProxy() return true, I could stop this removal.
>>>
>>> Do I need to set something in hibernate.hbm.xml?
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;/blockquote&gt;
>>> &lt;pre wrap=""&gt;&lt;!----&gt;
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;br&gt;
>>> &lt;/body&gt;
>>> &lt;/html&gt;
>>>
>>> Attachment decoded: untitled-3.htm
>>> --------------040705060809080707090006--
>>>
>>> </pre>
>>> </blockquote>
>>> <pre wrap=""><!---->
>>> </pre>
>>> </blockquote>
>>> <br>
>>> </body>
>>> </html>
>>>
>>> Attachment decoded: untitled-3.htm
>>> --------------010208080105080404000706--
>>>
>>>
>>
>>
>


--

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: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83367 is a reply to message #83325] Sat, 12 May 2007 08:25 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

In my xxx.genmodel's properties, there is 'Contaiment Proxies'
property in 'Model' section, the description for this property
is "Whether to respect the resolveProxies setting for containment
references" and its default value is 'false'.

After I changed this value as 'true' , everything is OK.

Thanks .


Anthony

> Anthony,
> I am not sure but does your first remark:
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> not already solve this issue? It seems like what Ed suggests.
>
> gr. Martin
>
> Ed Merks wrote:
>> Anthony,
>>
>> If you really need the parent and the child to be in separate
>> resources then you must make both ends proxy resolving, i.e., set
>> EReference.isResolveProxies to true. And I'm not sure how Teneo
>> handles it, but I imagine that a transient feature will not be
>> persisted, so probably you want to make the container side
>> non-transient...
>>
>>
>> Anthony wrote:
>>> Merks,
>>>
>>> Yes, both ends has explicit EReferences and the container side is
>>> transient, both ends are not proxy resolving.
>>>
>>>
>>> The question is :
>>>
>>> When I try to add new element which has set eContainer into
>>> resource
>>> contents , the eContainer is removed by inverseAdd(). So I don't
>>> know how to save these elements.
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>> Anthony,
>>>>
>>>> There isn't actually a question in your note so I'm not sure if you
>>>> are trying to ask one...
>>>>
>>>> Do you have explicit EReferences for both ends of the relationship?
>>>> Have you made the container side non-transient? And have you made
>>>> both ends proxy resolving?
>>>>
>>>>
>>>> Anthony wrote:
>>>>
>>>>> Merks,
>>>>>
>>>>> Actually I used Teneo to save my model into DB.
>>>>>
>>>>> Let me introduce the picture:
>>>>>
>>>>> When the first time the model is created , the only one
>>>>> ProductRegistry element is created and saved.
>>>>>
>>>>> And then when user click the Product node in UI, I need to
>>>>> show a table to list the products.
>>>>>
>>>>> Because the products collection could be really huge, so I
>>>>> choose
>>>>> to change them to many-to-one's (so only persist the reference
>>>>> from the child to the parent) and load the one-to-many relation
>>>>> (parent to child) on demand through an explicit query (make the
>>>>> many-reference from the parent to the child transient). Adding to
>>>>> the parent is then done by setting the parent feature in the
>>>>> child.
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Anthony,
>>>>>>
>>>>>> I'm not sure I completely follow what you are asking (container
>>>>>> is set as transient implies you don't want to serialize it), but
>>>>>> in the XMI serialization, to serialize a reference to the
>>>>>> container, you need to define a non-transient container feature
>>>>>> (i.e., an EReference that's the eOpposite of the containment
>>>>>> feature).
>>>>>>
>>>>>>
>>>>>> Anthony wrote:
>>>>>>
>>>>>>
>>>>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>>>>> @build.eclipse.org:
>>>>>>>
>>>>>>> Merks,
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> So if the container is set as transient, how to persist the
>>>>>>> container's element ?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Anthony,
>>>>>>>>
>>>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> containment
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>>>> EObject container and be contained directly by a resource's
>>>>>>>> getContents. Only for proxy resolving containment is it
>>>>>>>> possible to put a "child" in to
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> a
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> separate resource. Note that if Products parent is already in
>>>>>>>> a resource then product.eResource() will be non-null, and there
>>>>>>>> is no
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> need
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> to put the Product directly in the resource since it's
>>>>>>>> indirectly contained in the resource by virtue of the parent
>>>>>>>> being contained in a resource.
>>>>>>>>
>>>>>>>> Anthony wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> In my EMF model , Product and ProductRegistry has
>>>>>>>>> many-To-one
>>>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>>>
>>>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>>>
>>>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug
>>>>>>>>> mode
>>>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>>>> removal.
>>>>>>>>>
>>>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> Attachment decoded: untitled-2.txt
>>>>>> --------------040705060809080707090006
>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>>>> <html>
>>>>>> <head>
>>>>>> <meta content="text/html;charset=ISO-8859-1"
>>>>>> http-equiv="Content-Type">
>>>>>> </head>
>>>>>> <body bgcolor="#ffffff" text="#000000">
>>>>>> Anthony,<br>
>>>>>> <br>
>>>>>> I'm not sure I completely follow what you are asking (container
>>>>>> is set as transient implies you don't want to serialize it), but
>>>>>> in the XMI serialization, to serialize a reference to the
>>>>>> container, you need to define a non-transient container feature
>>>>>> (i.e., an EReference that's the eOpposite of the containment
>>>>>> feature).<br> <br>
>>>>>> <br>
>>>>>> Anthony wrote:
>>>>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>>>>> type="cite">
>>>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>>>>> wrote in <a class="moz-txt-link-freetext"
>>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>>>> @build.eclipse.org:
>>>>>>
>>>>>> Merks,
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> So if the container is set as transient, how to persist the
>>>>>> container's element ?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">Anthony,
>>>>>>
>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> <pre wrap=""><!---->containment
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>>>>> eContainer and
>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>> EObject container and be contained directly by a resource's
>>>>>> getContents. Only for proxy resolving containment is it possible
>>>>>> to put a "child" in to
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> <pre wrap=""><!---->a
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">separate resource. Note that if Products parent
>>>>>> is already in a
>>>>>> resource then product.eResource() will be non-null, and there is
>>>>>> no
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> <pre wrap=""><!---->need
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">to put the Product directly in the resource
>>>>>> since it's indirectly
>>>>>> contained in the resource by virtue of the parent being contained
>>>>>> in a resource.
>>>>>>
>>>>>> Anthony wrote:
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">Hi,
>>>>>>
>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>> relationship and ProductRegistry set as transient.
>>>>>>
>>>>>> I create a new Product and set it's eContainer as not null
>>>>>> and then add this Product element into HibernateResourse's
>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>
>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>> removal.
>>>>>>
>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> </blockquote>
>>>>>> <pre wrap=""><!---->
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> <br>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>> Attachment decoded: untitled-3.htm
>>>>>> --------------040705060809080707090006--
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>> Attachment decoded: untitled-2.txt
>>>> --------------010208080105080404000706
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>> <html>
>>>> <head>
>>>> <meta content="text/html;charset=ISO-8859-1"
>>>> http-equiv="Content-Type">
>>>> </head>
>>>> <body bgcolor="#ffffff" text="#000000">
>>>> Anthony,<br>
>>>> <br>
>>>> There isn't actually a question in your note so I'm not sure if you
>>>> are trying to ask one...<br>
>>>> <br>
>>>> Do you have explicit EReferences for both ends of the relationship?
>>>> Have you made the container side non-transient? And have you made
>>>> both ends proxy resolving?<br>
>>>> <br>
>>>> <br>
>>>> Anthony wrote:
>>>> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
>>>> type="cite">
>>>> <pre wrap="">Merks,
>>>>
>>>> Actually I used Teneo to save my model into DB.
>>>>
>>>> Let me introduce the picture:
>>>>
>>>> When the first time the model is created , the only one
>>>> ProductRegistry element is created and saved.
>>>>
>>>> And then when user click the Product node in UI, I need to
>>>> show a table to list the products.
>>>>
>>>> Because the products collection could be really huge, so I
>>>> choose
>>>> to change them to many-to-one's (so only persist the reference from
>>>> the child to the parent) and load the one-to-many relation (parent
>>>> to child) on demand through an explicit query (make the
>>>> many-reference from the parent to the child transient). Adding to
>>>> the parent is then done by setting the parent feature in the child.
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Anthony,
>>>>
>>>> I'm not sure I completely follow what you are asking (container is
>>>> set as transient implies you don't want to serialize it), but in
>>>> the XMI serialization, to serialize a reference to the container,
>>>> you need to define a non-transient container feature (i.e., an
>>>> EReference that's the eOpposite of the containment feature).
>>>>
>>>>
>>>> Anthony wrote:
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>>> wrote in <a class="moz-txt-link-freetext"
>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>> @build.eclipse.org:
>>>>
>>>> Merks,
>>>>
>>>> Thanks.
>>>>
>>>> So if the container is set as transient, how to persist the
>>>> container's element ?
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Anthony,
>>>>
>>>> This sounds like expected behavior. For non-proxy resolving
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap="">containment
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">reference (EReference.isResolveProxies ==
>>>> true), eContainer and
>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>> container and be contained directly by a resource's getContents.
>>>> Only for proxy resolving containment is it possible to put a
>>>> "child" in to
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap="">a
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">separate resource. Note that if Products
>>>> parent is already in a
>>>> resource then product.eResource() will be non-null, and there is no
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap="">need
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">to put the Product directly in the resource
>>>> since it's indirectly
>>>> contained in the resource by virtue of the parent being contained
>>>> in a resource.
>>>>
>>>> Anthony wrote:
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Hi,
>>>>
>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>> relationship and ProductRegistry set as transient.
>>>>
>>>> I create a new Product and set it's eContainer as not null
>>>> and then add this Product element into HibernateResourse's
>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>
>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>> to make the isResolveProxy() return true, I could stop this
>>>> removal.
>>>>
>>>> Do I need to set something in hibernate.hbm.xml?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> </blockquote>
>>>> <pre wrap="">
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap="">
>>>> Attachment decoded: untitled-2.txt
>>>> --------------040705060809080707090006
>>>> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
>>>> Transitional//EN"&gt; &lt;html&gt;
>>>> &lt;head&gt;
>>>> &lt;meta content="text/html;charset=ISO-8859-1"
>>>> http-equiv="Content-Type"&gt;
>>>> &lt;/head&gt;
>>>> &lt;body bgcolor="#ffffff" text="#000000"&gt;
>>>> Anthony,&lt;br&gt;
>>>> &lt;br&gt;
>>>> I'm not sure I completely follow what you are asking (container is
>>>> set as transient implies you don't want to serialize it), but in
>>>> the XMI serialization, to serialize a reference to the container,
>>>> you need to define a non-transient container feature (i.e., an
>>>> EReference that's the eOpposite of the containment
>>>> feature).&lt;br&gt; &lt;br&gt;
>>>> &lt;br&gt;
>>>> Anthony wrote:
>>>> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
>>>> href="mailto:midXns990FC81B5A375AnthonyLee@
>>>>
>>> 206.191.52.34">"midXns990FC8
>>>
>>>> 1B5A375AnthonyLee@206.191.52.34"</a>
>>>> type="cite"&gt;
>>>> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
>>>> href=<a class="moz-txt-link-rfc2396E"
>>>> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
>>>>
>>> &amp;
>>>
>>>> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
>>>> class="moz-txt-link-freetext" href=<a
>>>> class="moz-txt-link-rfc2396E"
>>>> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
>>>> class="moz-txt-link-freetext"
>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
>>>> @build.eclipse.org:
>>>>
>>>> Merks,
>>>>
>>>> Thanks.
>>>>
>>>> So if the container is set as transient, how to persist the
>>>> container's element ?
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;Anthony,
>>>>
>>>> This sounds like expected behavior. For non-proxy resolving
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;pre wrap=""&gt;&lt;!----&gt;containment
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
>>>> true), eContainer and
>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>> container and be contained directly by a resource's getContents.
>>>> Only for proxy resolving containment is it possible to put a
>>>> "child" in to
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;pre wrap=""&gt;&lt;!----&gt;a
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;separate resource. Note that if Products
>>>> parent is already in a
>>>> resource then product.eResource() will be non-null, and there is no
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;pre wrap=""&gt;&lt;!----&gt;need
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;to put the Product directly in the resource
>>>> since it's indirectly
>>>> contained in the resource by virtue of the parent being contained
>>>> in a resource.
>>>>
>>>> Anthony wrote:
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;Hi,
>>>>
>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>> relationship and ProductRegistry set as transient.
>>>>
>>>> I create a new Product and set it's eContainer as not null
>>>> and then add this Product element into HibernateResourse's
>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>
>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>> to make the isResolveProxy() return true, I could stop this
>>>> removal.
>>>>
>>>> Do I need to set something in hibernate.hbm.xml?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;pre wrap=""&gt;&lt;!----&gt;
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;br&gt;
>>>> &lt;/body&gt;
>>>> &lt;/html&gt;
>>>>
>>>> Attachment decoded: untitled-3.htm
>>>> --------------040705060809080707090006--
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap=""><!---->
>>>> </pre>
>>>> </blockquote>
>>>> <br>
>>>> </body>
>>>> </html>
>>>>
>>>> Attachment decoded: untitled-3.htm
>>>> --------------010208080105080404000706--
>>>>
>>>>
>>>
>>>
>>
>
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #83384 is a reply to message #83367] Sat, 12 May 2007 11:17 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------030303050303080507020407
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anthony,

Sorry, I really should have thought to mention that. :-(


Anthony wrote:
> Martin,
>
> In my xxx.genmodel's properties, there is 'Contaiment Proxies'
> property in 'Model' section, the description for this property
> is "Whether to respect the resolveProxies setting for containment
> references" and its default value is 'false'.
>
> After I changed this value as 'true' , everything is OK.
>
> Thanks .
>
>
> Anthony
>
>
>> Anthony,
>> I am not sure but does your first remark:
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> not already solve this issue? It seems like what Ed suggests.
>>
>> gr. Martin
>>
>> Ed Merks wrote:
>>
>>> Anthony,
>>>
>>> If you really need the parent and the child to be in separate
>>> resources then you must make both ends proxy resolving, i.e., set
>>> EReference.isResolveProxies to true. And I'm not sure how Teneo
>>> handles it, but I imagine that a transient feature will not be
>>> persisted, so probably you want to make the container side
>>> non-transient...
>>>
>>>
>>> Anthony wrote:
>>>
>>>> Merks,
>>>>
>>>> Yes, both ends has explicit EReferences and the container side is
>>>> transient, both ends are not proxy resolving.
>>>>
>>>>
>>>> The question is :
>>>>
>>>> When I try to add new element which has set eContainer into
>>>> resource
>>>> contents , the eContainer is removed by inverseAdd(). So I don't
>>>> know how to save these elements.
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>> Anthony,
>>>>>
>>>>> There isn't actually a question in your note so I'm not sure if you
>>>>> are trying to ask one...
>>>>>
>>>>> Do you have explicit EReferences for both ends of the relationship?
>>>>> Have you made the container side non-transient? And have you made
>>>>> both ends proxy resolving?
>>>>>
>>>>>
>>>>> Anthony wrote:
>>>>>
>>>>>
>>>>>> Merks,
>>>>>>
>>>>>> Actually I used Teneo to save my model into DB.
>>>>>>
>>>>>> Let me introduce the picture:
>>>>>>
>>>>>> When the first time the model is created , the only one
>>>>>> ProductRegistry element is created and saved.
>>>>>>
>>>>>> And then when user click the Product node in UI, I need to
>>>>>> show a table to list the products.
>>>>>>
>>>>>> Because the products collection could be really huge, so I
>>>>>> choose
>>>>>> to change them to many-to-one's (so only persist the reference
>>>>>> from the child to the parent) and load the one-to-many relation
>>>>>> (parent to child) on demand through an explicit query (make the
>>>>>> many-reference from the parent to the child transient). Adding to
>>>>>> the parent is then done by setting the parent feature in the
>>>>>> child.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Anthony,
>>>>>>>
>>>>>>> I'm not sure I completely follow what you are asking (container
>>>>>>> is set as transient implies you don't want to serialize it), but
>>>>>>> in the XMI serialization, to serialize a reference to the
>>>>>>> container, you need to define a non-transient container feature
>>>>>>> (i.e., an EReference that's the eOpposite of the containment
>>>>>>> feature).
>>>>>>>
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>>>>>> @build.eclipse.org:
>>>>>>>>
>>>>>>>> Merks,
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> So if the container is set as transient, how to persist the
>>>>>>>> container's element ?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Anthony,
>>>>>>>>>
>>>>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> containment
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>>>>> EObject container and be contained directly by a resource's
>>>>>>>>> getContents. Only for proxy resolving containment is it
>>>>>>>>> possible to put a "child" in to
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> a
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> separate resource. Note that if Products parent is already in
>>>>>>>>> a resource then product.eResource() will be non-null, and there
>>>>>>>>> is no
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> need
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> to put the Product directly in the resource since it's
>>>>>>>>> indirectly contained in the resource by virtue of the parent
>>>>>>>>> being contained in a resource.
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> In my EMF model , Product and ProductRegistry has
>>>>>>>>>> many-To-one
>>>>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>>>>
>>>>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>>>>
>>>>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug
>>>>>>>>>> mode
>>>>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>>>>> removal.
>>>>>>>>>>
>>>>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> Attachment decoded: untitled-2.txt
>>>>>>> --------------040705060809080707090006
>>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>>>>> <html>
>>>>>>> <head>
>>>>>>> <meta content="text/html;charset=ISO-8859-1"
>>>>>>> http-equiv="Content-Type">
>>>>>>> </head>
>>>>>>> <body bgcolor="#ffffff" text="#000000">
>>>>>>> Anthony,<br>
>>>>>>> <br>
>>>>>>> I'm not sure I completely follow what you are asking (container
>>>>>>> is set as transient implies you don't want to serialize it), but
>>>>>>> in the XMI serialization, to serialize a reference to the
>>>>>>> container, you need to define a non-transient container feature
>>>>>>> (i.e., an EReference that's the eOpposite of the containment
>>>>>>> feature).<br> <br>
>>>>>>> <br>
>>>>>>> Anthony wrote:
>>>>>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>>>>>> type="cite">
>>>>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>>>>>> wrote in <a class="moz-txt-link-freetext"
>>>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>>>>> @build.eclipse.org:
>>>>>>>
>>>>>>> Merks,
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> So if the container is set as transient, how to persist the
>>>>>>> container's element ?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">Anthony,
>>>>>>>
>>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> <pre wrap=""><!---->containment
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>>>>>> eContainer and
>>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>>> EObject container and be contained directly by a resource's
>>>>>>> getContents. Only for proxy resolving containment is it possible
>>>>>>> to put a "child" in to
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> <pre wrap=""><!---->a
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">separate resource. Note that if Products parent
>>>>>>> is already in a
>>>>>>> resource then product.eResource() will be non-null, and there is
>>>>>>> no
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> <pre wrap=""><!---->need
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">to put the Product directly in the resource
>>>>>>> since it's indirectly
>>>>>>> contained in the resource by virtue of the parent being contained
>>>>>>> in a resource.
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">Hi,
>>>>>>>
>>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>
>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>
>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>> removal.
>>>>>>>
>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> </blockquote>
>>>>>>> <pre wrap=""><!---->
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> <br>
>>>>>>> </body>
>>>>>>> </html>
>>>>>>>
>>>>>>> Attachment decoded: untitled-3.htm
>>>>>>> --------------040705060809080707090006--
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> Attachment decoded: untitled-2.txt
>>>>> --------------010208080105080404000706
>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>>> <html>
>>>>> <head>
>>>>> <meta content="text/html;charset=ISO-8859-1"
>>>>> http-equiv="Content-Type">
>>>>> </head>
>>>>> <body bgcolor="#ffffff" text="#000000">
>>>>> Anthony,<br>
>>>>> <br>
>>>>> There isn't actually a question in your note so I'm not sure if you
>>>>> are trying to ask one...<br>
>>>>> <br>
>>>>> Do you have explicit EReferences for both ends of the relationship?
>>>>> Have you made the container side non-transient? And have you made
>>>>> both ends proxy resolving?<br>
>>>>> <br>
>>>>> <br>
>>>>> Anthony wrote:
>>>>> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
>>>>> type="cite">
>>>>> <pre wrap="">Merks,
>>>>>
>>>>> Actually I used Teneo to save my model into DB.
>>>>>
>>>>> Let me introduce the picture:
>>>>>
>>>>> When the first time the model is created , the only one
>>>>> ProductRegistry element is created and saved.
>>>>>
>>>>> And then when user click the Product node in UI, I need to
>>>>> show a table to list the products.
>>>>>
>>>>> Because the products collection could be really huge, so I
>>>>> choose
>>>>> to change them to many-to-one's (so only persist the reference from
>>>>> the child to the parent) and load the one-to-many relation (parent
>>>>> to child) on demand through an explicit query (make the
>>>>> many-reference from the parent to the child transient). Adding to
>>>>> the parent is then done by setting the parent feature in the child.
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Anthony,
>>>>>
>>>>> I'm not sure I completely follow what you are asking (container is
>>>>> set as transient implies you don't want to serialize it), but in
>>>>> the XMI serialization, to serialize a reference to the container,
>>>>> you need to define a non-transient container feature (i.e., an
>>>>> EReference that's the eOpposite of the containment feature).
>>>>>
>>>>>
>>>>> Anthony wrote:
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>>>> wrote in <a class="moz-txt-link-freetext"
>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>>> @build.eclipse.org:
>>>>>
>>>>> Merks,
>>>>>
>>>>> Thanks.
>>>>>
>>>>> So if the container is set as transient, how to persist the
>>>>> container's element ?
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Anthony,
>>>>>
>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap="">containment
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">reference (EReference.isResolveProxies ==
>>>>> true), eContainer and
>>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>>> container and be contained directly by a resource's getContents.
>>>>> Only for proxy resolving containment is it possible to put a
>>>>> "child" in to
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap="">a
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">separate resource. Note that if Products
>>>>> parent is already in a
>>>>> resource then product.eResource() will be non-null, and there is no
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap="">need
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">to put the Product directly in the resource
>>>>> since it's indirectly
>>>>> contained in the resource by virtue of the parent being contained
>>>>> in a resource.
>>>>>
>>>>> Anthony wrote:
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Hi,
>>>>>
>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>> relationship and ProductRegistry set as transient.
>>>>>
>>>>> I create a new Product and set it's eContainer as not null
>>>>> and then add this Product element into HibernateResourse's
>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>
>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>> to make the isResolveProxy() return true, I could stop this
>>>>> removal.
>>>>>
>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> </blockquote>
>>>>> <pre wrap="">
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap="">
>>>>> Attachment decoded: untitled-2.txt
>>>>> --------------040705060809080707090006
>>>>> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
>>>>> Transitional//EN"&gt; &lt;html&gt;
>>>>> &lt;head&gt;
>>>>> &lt;meta content="text/html;charset=ISO-8859-1"
>>>>> http-equiv="Content-Type"&gt;
>>>>> &lt;/head&gt;
>>>>> &lt;body bgcolor="#ffffff" text="#000000"&gt;
>>>>> Anthony,&lt;br&gt;
>>>>> &lt;br&gt;
>>>>> I'm not sure I completely follow what you are asking (container is
>>>>> set as transient implies you don't want to serialize it), but in
>>>>> the XMI serialization, to serialize a reference to the container,
>>>>> you need to define a non-transient container feature (i.e., an
>>>>> EReference that's the eOpposite of the containment
>>>>> feature).&lt;br&gt; &lt;br&gt;
>>>>> &lt;br&gt;
>>>>> Anthony wrote:
>>>>> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
>>>>> href="mailto:midXns990FC81B5A375AnthonyLee@
>>>>>
>>>>>
>>>> 206.191.52.34">"midXns990FC8
>>>>
>>>>
>>>>> 1B5A375AnthonyLee@206.191.52.34"</a>
>>>>> type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
>>>>> href=<a class="moz-txt-link-rfc2396E"
>>>>> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
>>>>>
>>>>>
>>>> &amp;
>>>>
>>>>
>>>>> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
>>>>> class="moz-txt-link-freetext" href=<a
>>>>> class="moz-txt-link-rfc2396E"
>>>>> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
>>>>> class="moz-txt-link-freetext"
>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
>>>>> @build.eclipse.org:
>>>>>
>>>>> Merks,
>>>>>
>>>>> Thanks.
>>>>>
>>>>> So if the container is set as transient, how to persist the
>>>>> container's element ?
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;Anthony,
>>>>>
>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;pre wrap=""&gt;&lt;!----&gt;containment
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
>>>>> true), eContainer and
>>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>>> container and be contained directly by a resource's getContents.
>>>>> Only for proxy resolving containment is it possible to put a
>>>>> "child" in to
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;pre wrap=""&gt;&lt;!----&gt;a
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;separate resource. Note that if Products
>>>>> parent is already in a
>>>>> resource then product.eResource() will be non-null, and there is no
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;pre wrap=""&gt;&lt;!----&gt;need
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;to put the Product directly in the resource
>>>>> since it's indirectly
>>>>> contained in the resource by virtue of the parent being contained
>>>>> in a resource.
>>>>>
>>>>> Anthony wrote:
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;Hi,
>>>>>
>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>> relationship and ProductRegistry set as transient.
>>>>>
>>>>> I create a new Product and set it's eContainer as not null
>>>>> and then add this Product element into HibernateResourse's
>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>
>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>> to make the isResolveProxy() return true, I could stop this
>>>>> removal.
>>>>>
>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;pre wrap=""&gt;&lt;!----&gt;
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;br&gt;
>>>>> &lt;/body&gt;
>>>>> &lt;/html&gt;
>>>>>
>>>>> Attachment decoded: untitled-3.htm
>>>>> --------------040705060809080707090006--
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->
>>>>> </pre>
>>>>> </blockquote>
>>>>> <br>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>> Attachment decoded: untitled-3.htm
>>>>> --------------010208080105080404000706--
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>
>
>


--------------030303050303080507020407
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Anthony,<br>
<br>
Sorry, I really should have thought to mention that.&nbsp; :-(<br>
<br>
<br>
Anthony wrote:
<blockquote cite="midXns992EA6DCB84CDAnthonyLee@206.191.52.34"
type="cite">
<pre wrap="">Martin,

In my xxx.genmodel's properties, there is 'Contaiment Proxies'
property in 'Model' section, the description for this property
is "Whether to respect the resolveProxies setting for containment
references" and its default value is 'false'.

After I changed this value as 'true' , everything is OK.

Thanks .


Anthony

</pre>
<blockquote type="cite">
<pre wrap="">Anthony,
I am not sure but does your first remark:

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

not already solve this issue? It seems like what Ed suggests.

gr. Martin

Ed Merks wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

If you really need the parent and the child to be in separate
resources then you must make both ends proxy resolving, i.e., set
EReference.isResolveProxies to true. And I'm not sure how Teneo
handles it, but I imagine that a transient feature will not be
persisted, so probably you want to make the container side
non-transient...


Anthony wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Merks,

Yes, both ends has explicit EReferences and the container side is
transient, both ends are not proxy resolving.


The question is :

When I try to add new element which has set eContainer into
resource
contents , the eContainer is removed by inverseAdd(). So I don't
know how to save these elements.


Anthony



</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

There isn't actually a question in your note so I'm not sure if you
are trying to ask one...

Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made
both ends proxy resolving?


Anthony wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I
choose
to change them to many-to-one's (so only persist the reference
from the child to the parent) and load the one-to-many relation
(parent to child) on demand through an explicit query (make the
many-reference from the parent to the child transient). Adding to
the parent is then done by setting the parent feature in the
child.



Anthony







</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

I'm not sure I completely follow what you are asking (container
is set as transient implies you don't want to serialize it), but
in the XMI serialization, to serialize a reference to the
container, you need to define a non-transient container feature
(i.e., an EReference that's the eOpposite of the containment
feature).


Anthony wrote:


</pre>
<blockquote type="cite">
<pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony







</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

This sounds like expected behavior. For non-proxy resolving



</pre>
</blockquote>
<pre wrap="">containment



</pre>
<blockquote type="cite">
<pre wrap="">reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an
EObject container and be contained directly by a resource's
getContents. Only for proxy resolving containment is it
possible to put a "child" in to



</pre>
</blockquote>
<pre wrap="">a



</pre>
<blockquote type="cite">
<pre wrap="">separate resource. Note that if Products parent is already in
a resource then product.eResource() will be non-null, and there
is no



</pre>
</blockquote>
<pre wrap="">need



</pre>
<blockquote type="cite">
<pre wrap="">to put the Product directly in the resource since it's
indirectly contained in the resource by virtue of the parent
being contained in a resource.

Anthony wrote:



</pre>
<blockquote type="cite">
<pre wrap="">Hi,

In my EMF model , Product and ProductRegistry has
many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug
mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony







</pre>
</blockquote>
</blockquote>
<pre wrap="">


</pre>
</blockquote>
<pre wrap="">Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
I'm not sure I completely follow what you are asking (container
is set as transient implies you don't want to serialize it), but
in the XMI serialization, to serialize a reference to the
container, you need to define a non-transient container feature
(i.e., an EReference that's the eOpposite of the containment
feature).&lt;br&gt; &lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FC81B5A375AnthonyLee@206.191.52.34">"midXns990FC81B5A375AnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt;
wrote in &lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;containment
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies == true),
eContainer and
eDirectResource mutually exclusive, i.e., you can't have an
EObject container and be contained directly by a resource's
getContents. Only for proxy resolving containment is it possible
to put a "child" in to
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;a
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products parent
is already in a
resource then product.eResource() will be non-null, and there is
no
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;need
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource
since it's indirectly
contained in the resource by virtue of the parent being contained
in a resource.

Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------040705060809080707090006--



</pre>
</blockquote>
<pre wrap="">

</pre>
</blockquote>
<pre wrap="">Attachment decoded: untitled-2.txt
--------------010208080105080404000706
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
There isn't actually a question in your note so I'm not sure if you
are trying to ask one...&lt;br&gt;
&lt;br&gt;
Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made
both ends proxy resolving?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FCFB6F89BDAnthonyLee@206.191.52.34">"midXns990FCFB6F89BDAnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I
choose
to change them to many-to-one's (so only persist the reference from
the child to the parent) and load the one-to-many relation (parent
to child) on demand through an explicit query (make the
many-reference from the parent to the child transient). Adding to
the parent is then done by setting the parent feature in the child.



Anthony





&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

I'm not sure I completely follow what you are asking (container is
set as transient implies you don't want to serialize it), but in
the XMI serialization, to serialize a reference to the container,
you need to define a non-transient container feature (i.e., an
EReference that's the eOpposite of the containment feature).


Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt;
wrote in &lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony





&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;containment

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents.
Only for proxy resolving containment is it possible to put a
"child" in to

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;a

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products
parent is already in a
resource then product.eResource() will be non-null, and there is no

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;need

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource
since it's indirectly
contained in the resource by virtue of the parent being contained
in a resource.

Anthony wrote:

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony





&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;
Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"&amp;gt; &amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body bgcolor="#ffffff" text="#000000"&amp;gt;
Anthony,&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
I'm not sure I completely follow what you are asking (container is
set as transient implies you don't want to serialize it), but in
the XMI serialization, to serialize a reference to the container,
you need to define a non-transient container feature (i.e., an
EReference that's the eOpposite of the containment
feature).&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
Anthony wrote:
&amp;lt;blockquote cite=&lt;a class="moz-txt-link-rfc2396E"
href="<a class="moz-txt-link-freetext" href="mailto:midXns990FC81B5A375AnthonyLee@">mailto:midXns990FC81B5A375AnthonyLee@ </a>

</pre>
</blockquote>
<pre wrap="">206.191.52.34"&gt;"midXns990FC8

</pre>
<blockquote type="cite">
<pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:1B5A375AnthonyLee@206.191.52.34">1B5A375AnthonyLee@206.191.52.34</a>"&lt;/a&gt;
type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Ed Merks &amp;lt;a class="moz-txt-link-rfc2396E"
href=&lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&lt;/a&gt;&amp;gt;

</pre>
</blockquote>
<pre wrap="">&amp;amp;

</pre>
<blockquote type="cite">
<pre wrap=""> <a class="moz-txt-link-abbreviated" href="mailto:lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt">lt;merks@ca.ibm.com&amp;amp;gt;&amp;lt;/a&amp;gt</a>; wrote in &amp;lt;a
class="moz-txt-link-freetext" href=&lt;a
class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&lt;/a&gt;&amp;gt;&lt;a
class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;&amp;lt;/a&amp;gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;containment
&amp;lt;/pre&am
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606676 is a reply to message #83177] Fri, 11 May 2007 11:11 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
Is parent of the Product already present in the resource?

gr. Martin

Anthony wrote:
> Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>


--

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: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606677 is a reply to message #83177] Fri, 11 May 2007 11:19 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Anthony,

This sounds like expected behavior. For non-proxy resolving containment
reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents. Only
for proxy resolving containment is it possible to put a "child" in to a
separate resource. Note that if Products parent is already in a
resource then product.eResource() will be non-null, and there is no need
to put the Product directly in the resource since it's indirectly
contained in the resource by virtue of the parent being contained in a
resource.

Anthony wrote:
> Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606678 is a reply to message #83193] Fri, 11 May 2007 11:21 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin Taal <mtaal@elver.org> wrote in news:f21j0e$hdh$1
@build.eclipse.org:

> Hi,
> Is parent of the Product already present in the resource?
>
> gr. Martin
>
> Anthony wrote:
>> Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>
>

Hi,
It is not.
I have to use another resource to init the parent to get it
as EMF owner object to create AddChild command.

It seems the saving action would fail since the parent is not in the
same resource, but if the eContainer is not removed then the element is
saved in DB.

Anthony
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606679 is a reply to message #83204] Fri, 11 May 2007 11:41 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




> Anthony,
>
> This sounds like expected behavior. For non-proxy resolving
containment
> reference (EReference.isResolveProxies == true), eContainer and
> eDirectResource mutually exclusive, i.e., you can't have an EObject
> container and be contained directly by a resource's getContents. Only
> for proxy resolving containment is it possible to put a "child" in to
a
> separate resource. Note that if Products parent is already in a
> resource then product.eResource() will be non-null, and there is no
need
> to put the Product directly in the resource since it's indirectly
> contained in the resource by virtue of the parent being contained in a
> resource.
>
> Anthony wrote:
>> Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>>
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606680 is a reply to message #83227] Fri, 11 May 2007 12:07 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040705060809080707090006
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anthony,

I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's the
eOpposite of the containment feature).


Anthony wrote:
> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
> @build.eclipse.org:
>
> Merks,
>
> Thanks.
>
> So if the container is set as transient, how to persist the
> container's element ?
>
>
>
> Anthony
>
>
>
>
>
>> Anthony,
>>
>> This sounds like expected behavior. For non-proxy resolving
>>
> containment
>
>> reference (EReference.isResolveProxies == true), eContainer and
>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>> container and be contained directly by a resource's getContents. Only
>> for proxy resolving containment is it possible to put a "child" in to
>>
> a
>
>> separate resource. Note that if Products parent is already in a
>> resource then product.eResource() will be non-null, and there is no
>>
> need
>
>> to put the Product directly in the resource since it's indirectly
>> contained in the resource by virtue of the parent being contained in a
>> resource.
>>
>> Anthony wrote:
>>
>>> Hi,
>>>
>>> In my EMF model , Product and ProductRegistry has many-To-one
>>> relationship and ProductRegistry set as transient.
>>>
>>> I create a new Product and set it's eContainer as not null
>>> and then add this Product element into HibernateResourse's
>>> contents, in inverseAdd() ,the eContainer is removed.
>>>
>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>> to make the isResolveProxy() return true, I could stop this removal.
>>>
>>> Do I need to set something in hibernate.hbm.xml?
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>
>


--------------040705060809080707090006
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Anthony,<br>
<br>
I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).<br>
<br>
<br>
Anthony wrote:
<blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
type="cite">
<pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

This sounds like expected behavior. For non-proxy resolving
</pre>
</blockquote>
<pre wrap=""><!---->containment
</pre>
<blockquote type="cite">
<pre wrap="">reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents. Only
for proxy resolving containment is it possible to put a "child" in to
</pre>
</blockquote>
<pre wrap=""><!---->a
</pre>
<blockquote type="cite">
<pre wrap="">separate resource. Note that if Products parent is already in a
resource then product.eResource() will be non-null, and there is no
</pre>
</blockquote>
<pre wrap=""><!---->need
</pre>
<blockquote type="cite">
<pre wrap="">to put the Product directly in the resource since it's indirectly
contained in the resource by virtue of the parent being contained in a
resource.

Anthony wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------040705060809080707090006--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606681 is a reply to message #83243] Fri, 11 May 2007 12:26 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I choose
to change them to many-to-one's (so only persist the reference from the
child to the parent) and load the one-to-many relation (parent to child)
on demand through an explicit query (make the many-reference from the
parent to the child transient). Adding to the parent is then done by
setting the parent feature in the child.



Anthony





> Anthony,
>
> I'm not sure I completely follow what you are asking (container is set
> as transient implies you don't want to serialize it), but in the XMI
> serialization, to serialize a reference to the container, you need to
> define a non-transient container feature (i.e., an EReference that's
> the eOpposite of the containment feature).
>
>
> Anthony wrote:
>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>> @build.eclipse.org:
>>
>> Merks,
>>
>> Thanks.
>>
>> So if the container is set as transient, how to persist the
>> container's element ?
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>>
>>> Anthony,
>>>
>>> This sounds like expected behavior. For non-proxy resolving
>>>
>> containment
>>
>>> reference (EReference.isResolveProxies == true), eContainer and
>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>> container and be contained directly by a resource's getContents.
>>> Only for proxy resolving containment is it possible to put a "child"
>>> in to
>>>
>> a
>>
>>> separate resource. Note that if Products parent is already in a
>>> resource then product.eResource() will be non-null, and there is no
>>>
>> need
>>
>>> to put the Product directly in the resource since it's indirectly
>>> contained in the resource by virtue of the parent being contained in
>>> a resource.
>>>
>>> Anthony wrote:
>>>
>>>> Hi,
>>>>
>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>> relationship and ProductRegistry set as transient.
>>>>
>>>> I create a new Product and set it's eContainer as not null
>>>> and then add this Product element into HibernateResourse's
>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>
>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>> to make the isResolveProxy() return true, I could stop this
>>>> removal.
>>>>
>>>> Do I need to set something in hibernate.hbm.xml?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>
>
>
> Attachment decoded: untitled-2.txt
> --------------040705060809080707090006
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html;charset=ISO-8859-1"
> http-equiv="Content-Type">
> </head>
> <body bgcolor="#ffffff" text="#000000">
> Anthony,<br>
> <br>
> I'm not sure I completely follow what you are asking (container is set
> as transient implies you don't want to serialize it), but in the XMI
> serialization, to serialize a reference to the container, you need to
> define a non-transient container feature (i.e., an EReference that's
> the eOpposite of the containment feature).<br>
> <br>
> <br>
> Anthony wrote:
> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
> type="cite">
> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in
> <a class="moz-txt-link-freetext"
> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
> @build.eclipse.org:
>
> Merks,
>
> Thanks.
>
> So if the container is set as transient, how to persist the
> container's element ?
>
>
>
> Anthony
>
>
>
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">Anthony,
>
> This sounds like expected behavior. For non-proxy resolving
> </pre>
> </blockquote>
> <pre wrap=""><!---->containment
> </pre>
> <blockquote type="cite">
> <pre wrap="">reference (EReference.isResolveProxies == true),
> eContainer and
> eDirectResource mutually exclusive, i.e., you can't have an EObject
> container and be contained directly by a resource's getContents. Only
> for proxy resolving containment is it possible to put a "child" in to
> </pre>
> </blockquote>
> <pre wrap=""><!---->a
> </pre>
> <blockquote type="cite">
> <pre wrap="">separate resource. Note that if Products parent is
> already in a
> resource then product.eResource() will be non-null, and there is no
> </pre>
> </blockquote>
> <pre wrap=""><!---->need
> </pre>
> <blockquote type="cite">
> <pre wrap="">to put the Product directly in the resource since
> it's indirectly
> contained in the resource by virtue of the parent being contained in a
> resource.
>
> Anthony wrote:
> </pre>
> <blockquote type="cite">
> <pre wrap="">Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>
>
> </pre>
> </blockquote>
> </blockquote>
> <pre wrap=""><!---->
> </pre>
> </blockquote>
> <br>
> </body>
> </html>
>
> Attachment decoded: untitled-3.htm
> --------------040705060809080707090006--
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606682 is a reply to message #83257] Fri, 11 May 2007 12:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010208080105080404000706
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anthony,

There isn't actually a question in your note so I'm not sure if you are
trying to ask one...

Do you have explicit EReferences for both ends of the relationship? Have
you made the container side non-transient? And have you made both ends
proxy resolving?


Anthony wrote:
> Merks,
>
> Actually I used Teneo to save my model into DB.
>
> Let me introduce the picture:
>
> When the first time the model is created , the only one
> ProductRegistry element is created and saved.
>
> And then when user click the Product node in UI, I need to
> show a table to list the products.
>
> Because the products collection could be really huge, so I choose
> to change them to many-to-one's (so only persist the reference from the
> child to the parent) and load the one-to-many relation (parent to child)
> on demand through an explicit query (make the many-reference from the
> parent to the child transient). Adding to the parent is then done by
> setting the parent feature in the child.
>
>
>
> Anthony
>
>
>
>
>
>
>> Anthony,
>>
>> I'm not sure I completely follow what you are asking (container is set
>> as transient implies you don't want to serialize it), but in the XMI
>> serialization, to serialize a reference to the container, you need to
>> define a non-transient container feature (i.e., an EReference that's
>> the eOpposite of the containment feature).
>>
>>
>> Anthony wrote:
>>
>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>> @build.eclipse.org:
>>>
>>> Merks,
>>>
>>> Thanks.
>>>
>>> So if the container is set as transient, how to persist the
>>> container's element ?
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>>
>>>> Anthony,
>>>>
>>>> This sounds like expected behavior. For non-proxy resolving
>>>>
>>>>
>>> containment
>>>
>>>
>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>> container and be contained directly by a resource's getContents.
>>>> Only for proxy resolving containment is it possible to put a "child"
>>>> in to
>>>>
>>>>
>>> a
>>>
>>>
>>>> separate resource. Note that if Products parent is already in a
>>>> resource then product.eResource() will be non-null, and there is no
>>>>
>>>>
>>> need
>>>
>>>
>>>> to put the Product directly in the resource since it's indirectly
>>>> contained in the resource by virtue of the parent being contained in
>>>> a resource.
>>>>
>>>> Anthony wrote:
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>> relationship and ProductRegistry set as transient.
>>>>>
>>>>> I create a new Product and set it's eContainer as not null
>>>>> and then add this Product element into HibernateResourse's
>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>
>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>> to make the isResolveProxy() return true, I could stop this
>>>>> removal.
>>>>>
>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>> Attachment decoded: untitled-2.txt
>> --------------040705060809080707090006
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>> <head>
>> <meta content="text/html;charset=ISO-8859-1"
>> http-equiv="Content-Type">
>> </head>
>> <body bgcolor="#ffffff" text="#000000">
>> Anthony,<br>
>> <br>
>> I'm not sure I completely follow what you are asking (container is set
>> as transient implies you don't want to serialize it), but in the XMI
>> serialization, to serialize a reference to the container, you need to
>> define a non-transient container feature (i.e., an EReference that's
>> the eOpposite of the containment feature).<br>
>> <br>
>> <br>
>> Anthony wrote:
>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>> type="cite">
>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in
>> <a class="moz-txt-link-freetext"
>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>> @build.eclipse.org:
>>
>> Merks,
>>
>> Thanks.
>>
>> So if the container is set as transient, how to persist the
>> container's element ?
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Anthony,
>>
>> This sounds like expected behavior. For non-proxy resolving
>> </pre>
>> </blockquote>
>> <pre wrap=""><!---->containment
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">reference (EReference.isResolveProxies == true),
>> eContainer and
>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>> container and be contained directly by a resource's getContents. Only
>> for proxy resolving containment is it possible to put a "child" in to
>> </pre>
>> </blockquote>
>> <pre wrap=""><!---->a
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">separate resource. Note that if Products parent is
>> already in a
>> resource then product.eResource() will be non-null, and there is no
>> </pre>
>> </blockquote>
>> <pre wrap=""><!---->need
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">to put the Product directly in the resource since
>> it's indirectly
>> contained in the resource by virtue of the parent being contained in a
>> resource.
>>
>> Anthony wrote:
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>>
>> </pre>
>> </blockquote>
>> </blockquote>
>> <pre wrap=""><!---->
>> </pre>
>> </blockquote>
>> <br>
>> </body>
>> </html>
>>
>> Attachment decoded: untitled-3.htm
>> --------------040705060809080707090006--
>>
>>
>
>


--------------010208080105080404000706
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Anthony,<br>
<br>
There isn't actually a question in your note so I'm not sure if you are
trying to ask one...<br>
<br>
Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made both
ends proxy resolving?<br>
<br>
<br>
Anthony wrote:
<blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
type="cite">
<pre wrap="">Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I choose
to change them to many-to-one's (so only persist the reference from the
child to the parent) and load the one-to-many relation (parent to child)
on demand through an explicit query (make the many-reference from the
parent to the child transient). Adding to the parent is then done by
setting the parent feature in the child.



Anthony





</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).


Anthony wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony





</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

This sounds like expected behavior. For non-proxy resolving

</pre>
</blockquote>
<pre wrap="">containment

</pre>
<blockquote type="cite">
<pre wrap="">reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents.
Only for proxy resolving containment is it possible to put a "child"
in to

</pre>
</blockquote>
<pre wrap="">a

</pre>
<blockquote type="cite">
<pre wrap="">separate resource. Note that if Products parent is already in a
resource then product.eResource() will be non-null, and there is no

</pre>
</blockquote>
<pre wrap="">need

</pre>
<blockquote type="cite">
<pre wrap="">to put the Product directly in the resource since it's indirectly
contained in the resource by virtue of the parent being contained in
a resource.

Anthony wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony





</pre>
</blockquote>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap="">
Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FC81B5A375AnthonyLee@206.191.52.34">"midXns990FC81B5A375AnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in
&lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;containment
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies == true),
eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents. Only
for proxy resolving containment is it possible to put a "child" in to
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;a
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products parent is
already in a
resource then product.eResource() will be non-null, and there is no
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;need
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource since
it's indirectly
contained in the resource by virtue of the parent being contained in a
resource.

Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------040705060809080707090006--

</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------010208080105080404000706--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606683 is a reply to message #83273] Fri, 11 May 2007 12:46 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Merks,

Yes, both ends has explicit EReferences and the container side is
transient, both ends are not proxy resolving.


The question is :

When I try to add new element which has set eContainer into resource
contents , the eContainer is removed by inverseAdd(). So I don't know
how to save these elements.


Anthony


> Anthony,
>
> There isn't actually a question in your note so I'm not sure if you
> are trying to ask one...
>
> Do you have explicit EReferences for both ends of the relationship?
> Have you made the container side non-transient? And have you made both
> ends proxy resolving?
>
>
> Anthony wrote:
>> Merks,
>>
>> Actually I used Teneo to save my model into DB.
>>
>> Let me introduce the picture:
>>
>> When the first time the model is created , the only one
>> ProductRegistry element is created and saved.
>>
>> And then when user click the Product node in UI, I need to
>> show a table to list the products.
>>
>> Because the products collection could be really huge, so I
>> choose
>> to change them to many-to-one's (so only persist the reference from
>> the child to the parent) and load the one-to-many relation (parent to
>> child) on demand through an explicit query (make the many-reference
>> from the parent to the child transient). Adding to the parent is then
>> done by setting the parent feature in the child.
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>>
>>
>>> Anthony,
>>>
>>> I'm not sure I completely follow what you are asking (container is
>>> set as transient implies you don't want to serialize it), but in the
>>> XMI serialization, to serialize a reference to the container, you
>>> need to define a non-transient container feature (i.e., an
>>> EReference that's the eOpposite of the containment feature).
>>>
>>>
>>> Anthony wrote:
>>>
>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>> @build.eclipse.org:
>>>>
>>>> Merks,
>>>>
>>>> Thanks.
>>>>
>>>> So if the container is set as transient, how to persist the
>>>> container's element ?
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Anthony,
>>>>>
>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>
>>>>>
>>>> containment
>>>>
>>>>
>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>> EObject container and be contained directly by a resource's
>>>>> getContents. Only for proxy resolving containment is it possible
>>>>> to put a "child" in to
>>>>>
>>>>>
>>>> a
>>>>
>>>>
>>>>> separate resource. Note that if Products parent is already in a
>>>>> resource then product.eResource() will be non-null, and there is
>>>>> no
>>>>>
>>>>>
>>>> need
>>>>
>>>>
>>>>> to put the Product directly in the resource since it's indirectly
>>>>> contained in the resource by virtue of the parent being contained
>>>>> in a resource.
>>>>>
>>>>> Anthony wrote:
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>> relationship and ProductRegistry set as transient.
>>>>>>
>>>>>> I create a new Product and set it's eContainer as not null
>>>>>> and then add this Product element into HibernateResourse's
>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>
>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>> removal.
>>>>>>
>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>> Attachment decoded: untitled-2.txt
>>> --------------040705060809080707090006
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>> <html>
>>> <head>
>>> <meta content="text/html;charset=ISO-8859-1"
>>> http-equiv="Content-Type">
>>> </head>
>>> <body bgcolor="#ffffff" text="#000000">
>>> Anthony,<br>
>>> <br>
>>> I'm not sure I completely follow what you are asking (container is
>>> set as transient implies you don't want to serialize it), but in the
>>> XMI serialization, to serialize a reference to the container, you
>>> need to define a non-transient container feature (i.e., an
>>> EReference that's the eOpposite of the containment feature).<br>
>>> <br>
>>> <br>
>>> Anthony wrote:
>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>> type="cite">
>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote
>>> in <a class="moz-txt-link-freetext"
>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>> @build.eclipse.org:
>>>
>>> Merks,
>>>
>>> Thanks.
>>>
>>> So if the container is set as transient, how to persist the
>>> container's element ?
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Anthony,
>>>
>>> This sounds like expected behavior. For non-proxy resolving
>>> </pre>
>>> </blockquote>
>>> <pre wrap=""><!---->containment
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>> eContainer and
>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>> container and be contained directly by a resource's getContents.
>>> Only for proxy resolving containment is it possible to put a "child"
>>> in to
>>> </pre>
>>> </blockquote>
>>> <pre wrap=""><!---->a
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">separate resource. Note that if Products parent is
>>> already in a
>>> resource then product.eResource() will be non-null, and there is no
>>> </pre>
>>> </blockquote>
>>> <pre wrap=""><!---->need
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">to put the Product directly in the resource since
>>> it's indirectly
>>> contained in the resource by virtue of the parent being contained in
>>> a resource.
>>>
>>> Anthony wrote:
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Hi,
>>>
>>> In my EMF model , Product and ProductRegistry has many-To-one
>>> relationship and ProductRegistry set as transient.
>>>
>>> I create a new Product and set it's eContainer as not null
>>> and then add this Product element into HibernateResourse's
>>> contents, in inverseAdd() ,the eContainer is removed.
>>>
>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>> to make the isResolveProxy() return true, I could stop this removal.
>>>
>>> Do I need to set something in hibernate.hbm.xml?
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>> </pre>
>>> </blockquote>
>>> </blockquote>
>>> <pre wrap=""><!---->
>>> </pre>
>>> </blockquote>
>>> <br>
>>> </body>
>>> </html>
>>>
>>> Attachment decoded: untitled-3.htm
>>> --------------040705060809080707090006--
>>>
>>>
>>
>>
>
>
> Attachment decoded: untitled-2.txt
> --------------010208080105080404000706
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html;charset=ISO-8859-1"
> http-equiv="Content-Type">
> </head>
> <body bgcolor="#ffffff" text="#000000">
> Anthony,<br>
> <br>
> There isn't actually a question in your note so I'm not sure if you
> are trying to ask one...<br>
> <br>
> Do you have explicit EReferences for both ends of the relationship?
> Have you made the container side non-transient? And have you made both
> ends proxy resolving?<br>
> <br>
> <br>
> Anthony wrote:
> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
> type="cite">
> <pre wrap="">Merks,
>
> Actually I used Teneo to save my model into DB.
>
> Let me introduce the picture:
>
> When the first time the model is created , the only one
> ProductRegistry element is created and saved.
>
> And then when user click the Product node in UI, I need to
> show a table to list the products.
>
> Because the products collection could be really huge, so I
> choose
> to change them to many-to-one's (so only persist the reference from
> the child to the parent) and load the one-to-many relation (parent to
> child) on demand through an explicit query (make the many-reference
> from the parent to the child transient). Adding to the parent is then
> done by setting the parent feature in the child.
>
>
>
> Anthony
>
>
>
>
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">Anthony,
>
> I'm not sure I completely follow what you are asking (container is set
> as transient implies you don't want to serialize it), but in the XMI
> serialization, to serialize a reference to the container, you need to
> define a non-transient container feature (i.e., an EReference that's
> the eOpposite of the containment feature).
>
>
> Anthony wrote:
> </pre>
> <blockquote type="cite">
> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
> wrote in <a class="moz-txt-link-freetext"
> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
> @build.eclipse.org:
>
> Merks,
>
> Thanks.
>
> So if the container is set as transient, how to persist the
> container's element ?
>
>
>
> Anthony
>
>
>
>
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">Anthony,
>
> This sounds like expected behavior. For non-proxy resolving
>
> </pre>
> </blockquote>
> <pre wrap="">containment
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">reference (EReference.isResolveProxies == true),
> eContainer and
> eDirectResource mutually exclusive, i.e., you can't have an EObject
> container and be contained directly by a resource's getContents.
> Only for proxy resolving containment is it possible to put a "child"
> in to
>
> </pre>
> </blockquote>
> <pre wrap="">a
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">separate resource. Note that if Products parent
> is already in a
> resource then product.eResource() will be non-null, and there is no
>
> </pre>
> </blockquote>
> <pre wrap="">need
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">to put the Product directly in the resource since
> it's indirectly
> contained in the resource by virtue of the parent being contained in
> a resource.
>
> Anthony wrote:
>
> </pre>
> <blockquote type="cite">
> <pre wrap="">Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this
> removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>
>
>
> </pre>
> </blockquote>
> </blockquote>
> <pre wrap="">
> </pre>
> </blockquote>
> <pre wrap="">
> Attachment decoded: untitled-2.txt
> --------------040705060809080707090006
> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
> &lt;html&gt;
> &lt;head&gt;
> &lt;meta content="text/html;charset=ISO-8859-1"
> http-equiv="Content-Type"&gt;
> &lt;/head&gt;
> &lt;body bgcolor="#ffffff" text="#000000"&gt;
> Anthony,&lt;br&gt;
> &lt;br&gt;
> I'm not sure I completely follow what you are asking (container is set
> as transient implies you don't want to serialize it), but in the XMI
> serialization, to serialize a reference to the container, you need to
> define a non-transient container feature (i.e., an EReference that's
> the eOpposite of the containment feature).&lt;br&gt;
> &lt;br&gt;
> &lt;br&gt;
> Anthony wrote:
> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
> href="mailto:midXns990FC81B5A375AnthonyLee@
206.191.52.34">"midXns990FC8
> 1B5A375AnthonyLee@206.191.52.34"</a>
> type="cite"&gt;
> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
> href=<a class="moz-txt-link-rfc2396E"
> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
&amp;
> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
> class="moz-txt-link-freetext" href=<a class="moz-txt-link-rfc2396E"
> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
> class="moz-txt-link-freetext"
> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
> @build.eclipse.org:
>
> Merks,
>
> Thanks.
>
> So if the container is set as transient, how to persist the
> container's element ?
>
>
>
> Anthony
>
>
>
>
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;Anthony,
>
> This sounds like expected behavior. For non-proxy resolving
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;pre wrap=""&gt;&lt;!----&gt;containment
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
> true), eContainer and
> eDirectResource mutually exclusive, i.e., you can't have an EObject
> container and be contained directly by a resource's getContents. Only
> for proxy resolving containment is it possible to put a "child" in to
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;pre wrap=""&gt;&lt;!----&gt;a
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;separate resource. Note that if Products
> parent is already in a
> resource then product.eResource() will be non-null, and there is no
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;pre wrap=""&gt;&lt;!----&gt;need
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;to put the Product directly in the resource
> since it's indirectly
> contained in the resource by virtue of the parent being contained in a
> resource.
>
> Anthony wrote:
> &lt;/pre&gt;
> &lt;blockquote type="cite"&gt;
> &lt;pre wrap=""&gt;Hi,
>
> In my EMF model , Product and ProductRegistry has many-To-one
> relationship and ProductRegistry set as transient.
>
> I create a new Product and set it's eContainer as not null
> and then add this Product element into HibernateResourse's
> contents, in inverseAdd() ,the eContainer is removed.
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> Do I need to set something in hibernate.hbm.xml?
>
> Anthony
>
>
>
>
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;/blockquote&gt;
> &lt;pre wrap=""&gt;&lt;!----&gt;
> &lt;/pre&gt;
> &lt;/blockquote&gt;
> &lt;br&gt;
> &lt;/body&gt;
> &lt;/html&gt;
>
> Attachment decoded: untitled-3.htm
> --------------040705060809080707090006--
>
> </pre>
> </blockquote>
> <pre wrap=""><!---->
> </pre>
> </blockquote>
> <br>
> </body>
> </html>
>
> Attachment decoded: untitled-3.htm
> --------------010208080105080404000706--
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606684 is a reply to message #83290] Fri, 11 May 2007 12:50 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010504090600060301080902
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anthony,

If you really need the parent and the child to be in separate resources
then you must make both ends proxy resolving, i.e., set
EReference.isResolveProxies to true. And I'm not sure how Teneo
handles it, but I imagine that a transient feature will not be
persisted, so probably you want to make the container side non-transient...


Anthony wrote:
> Merks,
>
> Yes, both ends has explicit EReferences and the container side is
> transient, both ends are not proxy resolving.
>
>
> The question is :
>
> When I try to add new element which has set eContainer into resource
> contents , the eContainer is removed by inverseAdd(). So I don't know
> how to save these elements.
>
>
> Anthony
>
>
>
>> Anthony,
>>
>> There isn't actually a question in your note so I'm not sure if you
>> are trying to ask one...
>>
>> Do you have explicit EReferences for both ends of the relationship?
>> Have you made the container side non-transient? And have you made both
>> ends proxy resolving?
>>
>>
>> Anthony wrote:
>>
>>> Merks,
>>>
>>> Actually I used Teneo to save my model into DB.
>>>
>>> Let me introduce the picture:
>>>
>>> When the first time the model is created , the only one
>>> ProductRegistry element is created and saved.
>>>
>>> And then when user click the Product node in UI, I need to
>>> show a table to list the products.
>>>
>>> Because the products collection could be really huge, so I
>>> choose
>>> to change them to many-to-one's (so only persist the reference from
>>> the child to the parent) and load the one-to-many relation (parent to
>>> child) on demand through an explicit query (make the many-reference
>>> from the parent to the child transient). Adding to the parent is then
>>> done by setting the parent feature in the child.
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>> Anthony,
>>>>
>>>> I'm not sure I completely follow what you are asking (container is
>>>> set as transient implies you don't want to serialize it), but in the
>>>> XMI serialization, to serialize a reference to the container, you
>>>> need to define a non-transient container feature (i.e., an
>>>> EReference that's the eOpposite of the containment feature).
>>>>
>>>>
>>>> Anthony wrote:
>>>>
>>>>
>>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>>> @build.eclipse.org:
>>>>>
>>>>> Merks,
>>>>>
>>>>> Thanks.
>>>>>
>>>>> So if the container is set as transient, how to persist the
>>>>> container's element ?
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Anthony,
>>>>>>
>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>
>>>>>>
>>>>>>
>>>>> containment
>>>>>
>>>>>
>>>>>
>>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>> EObject container and be contained directly by a resource's
>>>>>> getContents. Only for proxy resolving containment is it possible
>>>>>> to put a "child" in to
>>>>>>
>>>>>>
>>>>>>
>>>>> a
>>>>>
>>>>>
>>>>>
>>>>>> separate resource. Note that if Products parent is already in a
>>>>>> resource then product.eResource() will be non-null, and there is
>>>>>> no
>>>>>>
>>>>>>
>>>>>>
>>>>> need
>>>>>
>>>>>
>>>>>
>>>>>> to put the Product directly in the resource since it's indirectly
>>>>>> contained in the resource by virtue of the parent being contained
>>>>>> in a resource.
>>>>>>
>>>>>> Anthony wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>
>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>
>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>> removal.
>>>>>>>
>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>> Attachment decoded: untitled-2.txt
>>>> --------------040705060809080707090006
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>> <html>
>>>> <head>
>>>> <meta content="text/html;charset=ISO-8859-1"
>>>> http-equiv="Content-Type">
>>>> </head>
>>>> <body bgcolor="#ffffff" text="#000000">
>>>> Anthony,<br>
>>>> <br>
>>>> I'm not sure I completely follow what you are asking (container is
>>>> set as transient implies you don't want to serialize it), but in the
>>>> XMI serialization, to serialize a reference to the container, you
>>>> need to define a non-transient container feature (i.e., an
>>>> EReference that's the eOpposite of the containment feature).<br>
>>>> <br>
>>>> <br>
>>>> Anthony wrote:
>>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>>> type="cite">
>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote
>>>> in <a class="moz-txt-link-freetext"
>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>> @build.eclipse.org:
>>>>
>>>> Merks,
>>>>
>>>> Thanks.
>>>>
>>>> So if the container is set as transient, how to persist the
>>>> container's element ?
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Anthony,
>>>>
>>>> This sounds like expected behavior. For non-proxy resolving
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap=""><!---->containment
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>>> eContainer and
>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>> container and be contained directly by a resource's getContents.
>>>> Only for proxy resolving containment is it possible to put a "child"
>>>> in to
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap=""><!---->a
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">separate resource. Note that if Products parent is
>>>> already in a
>>>> resource then product.eResource() will be non-null, and there is no
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap=""><!---->need
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">to put the Product directly in the resource since
>>>> it's indirectly
>>>> contained in the resource by virtue of the parent being contained in
>>>> a resource.
>>>>
>>>> Anthony wrote:
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Hi,
>>>>
>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>> relationship and ProductRegistry set as transient.
>>>>
>>>> I create a new Product and set it's eContainer as not null
>>>> and then add this Product element into HibernateResourse's
>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>
>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>> to make the isResolveProxy() return true, I could stop this removal.
>>>>
>>>> Do I need to set something in hibernate.hbm.xml?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> </blockquote>
>>>> <pre wrap=""><!---->
>>>> </pre>
>>>> </blockquote>
>>>> <br>
>>>> </body>
>>>> </html>
>>>>
>>>> Attachment decoded: untitled-3.htm
>>>> --------------040705060809080707090006--
>>>>
>>>>
>>>>
>>>
>>>
>> Attachment decoded: untitled-2.txt
>> --------------010208080105080404000706
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>> <head>
>> <meta content="text/html;charset=ISO-8859-1"
>> http-equiv="Content-Type">
>> </head>
>> <body bgcolor="#ffffff" text="#000000">
>> Anthony,<br>
>> <br>
>> There isn't actually a question in your note so I'm not sure if you
>> are trying to ask one...<br>
>> <br>
>> Do you have explicit EReferences for both ends of the relationship?
>> Have you made the container side non-transient? And have you made both
>> ends proxy resolving?<br>
>> <br>
>> <br>
>> Anthony wrote:
>> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
>> type="cite">
>> <pre wrap="">Merks,
>>
>> Actually I used Teneo to save my model into DB.
>>
>> Let me introduce the picture:
>>
>> When the first time the model is created , the only one
>> ProductRegistry element is created and saved.
>>
>> And then when user click the Product node in UI, I need to
>> show a table to list the products.
>>
>> Because the products collection could be really huge, so I
>> choose
>> to change them to many-to-one's (so only persist the reference from
>> the child to the parent) and load the one-to-many relation (parent to
>> child) on demand through an explicit query (make the many-reference
>> from the parent to the child transient). Adding to the parent is then
>> done by setting the parent feature in the child.
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Anthony,
>>
>> I'm not sure I completely follow what you are asking (container is set
>> as transient implies you don't want to serialize it), but in the XMI
>> serialization, to serialize a reference to the container, you need to
>> define a non-transient container feature (i.e., an EReference that's
>> the eOpposite of the containment feature).
>>
>>
>> Anthony wrote:
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>> wrote in <a class="moz-txt-link-freetext"
>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>> @build.eclipse.org:
>>
>> Merks,
>>
>> Thanks.
>>
>> So if the container is set as transient, how to persist the
>> container's element ?
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Anthony,
>>
>> This sounds like expected behavior. For non-proxy resolving
>>
>> </pre>
>> </blockquote>
>> <pre wrap="">containment
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">reference (EReference.isResolveProxies == true),
>> eContainer and
>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>> container and be contained directly by a resource's getContents.
>> Only for proxy resolving containment is it possible to put a "child"
>> in to
>>
>> </pre>
>> </blockquote>
>> <pre wrap="">a
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">separate resource. Note that if Products parent
>> is already in a
>> resource then product.eResource() will be non-null, and there is no
>>
>> </pre>
>> </blockquote>
>> <pre wrap="">need
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">to put the Product directly in the resource since
>> it's indirectly
>> contained in the resource by virtue of the parent being contained in
>> a resource.
>>
>> Anthony wrote:
>>
>> </pre>
>> <blockquote type="cite">
>> <pre wrap="">Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this
>> removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>>
>>
>> </pre>
>> </blockquote>
>> </blockquote>
>> <pre wrap="">
>> </pre>
>> </blockquote>
>> <pre wrap="">
>> Attachment decoded: untitled-2.txt
>> --------------040705060809080707090006
>> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
>> &lt;html&gt;
>> &lt;head&gt;
>> &lt;meta content="text/html;charset=ISO-8859-1"
>> http-equiv="Content-Type"&gt;
>> &lt;/head&gt;
>> &lt;body bgcolor="#ffffff" text="#000000"&gt;
>> Anthony,&lt;br&gt;
>> &lt;br&gt;
>> I'm not sure I completely follow what you are asking (container is set
>> as transient implies you don't want to serialize it), but in the XMI
>> serialization, to serialize a reference to the container, you need to
>> define a non-transient container feature (i.e., an EReference that's
>> the eOpposite of the containment feature).&lt;br&gt;
>> &lt;br&gt;
>> &lt;br&gt;
>> Anthony wrote:
>> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
>> href="mailto:midXns990FC81B5A375AnthonyLee@
>>
> 206.191.52.34">"midXns990FC8
>
>> 1B5A375AnthonyLee@206.191.52.34"</a>
>> type="cite"&gt;
>> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
>> href=<a class="moz-txt-link-rfc2396E"
>> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
>>
> &amp;
>
>> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
>> class="moz-txt-link-freetext" href=<a class="moz-txt-link-rfc2396E"
>> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
>> class="moz-txt-link-freetext"
>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
>> @build.eclipse.org:
>>
>> Merks,
>>
>> Thanks.
>>
>> So if the container is set as transient, how to persist the
>> container's element ?
>>
>>
>>
>> Anthony
>>
>>
>>
>>
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;Anthony,
>>
>> This sounds like expected behavior. For non-proxy resolving
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;pre wrap=""&gt;&lt;!----&gt;containment
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
>> true), eContainer and
>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>> container and be contained directly by a resource's getContents. Only
>> for proxy resolving containment is it possible to put a "child" in to
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;pre wrap=""&gt;&lt;!----&gt;a
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;separate resource. Note that if Products
>> parent is already in a
>> resource then product.eResource() will be non-null, and there is no
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;pre wrap=""&gt;&lt;!----&gt;need
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;to put the Product directly in the resource
>> since it's indirectly
>> contained in the resource by virtue of the parent being contained in a
>> resource.
>>
>> Anthony wrote:
>> &lt;/pre&gt;
>> &lt;blockquote type="cite"&gt;
>> &lt;pre wrap=""&gt;Hi,
>>
>> In my EMF model , Product and ProductRegistry has many-To-one
>> relationship and ProductRegistry set as transient.
>>
>> I create a new Product and set it's eContainer as not null
>> and then add this Product element into HibernateResourse's
>> contents, in inverseAdd() ,the eContainer is removed.
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> Do I need to set something in hibernate.hbm.xml?
>>
>> Anthony
>>
>>
>>
>>
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;/blockquote&gt;
>> &lt;pre wrap=""&gt;&lt;!----&gt;
>> &lt;/pre&gt;
>> &lt;/blockquote&gt;
>> &lt;br&gt;
>> &lt;/body&gt;
>> &lt;/html&gt;
>>
>> Attachment decoded: untitled-3.htm
>> --------------040705060809080707090006--
>>
>> </pre>
>> </blockquote>
>> <pre wrap=""><!---->
>> </pre>
>> </blockquote>
>> <br>
>> </body>
>> </html>
>>
>> Attachment decoded: untitled-3.htm
>> --------------010208080105080404000706--
>>
>>
>
>


--------------010504090600060301080902
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Anthony,<br>
<br>
If you really need the parent and the child to be in separate resources
then you must make both ends proxy resolving, i.e., set
EReference.isResolveProxies to true. &nbsp; And I'm not sure how Teneo
handles it, but I imagine that a transient feature will not be
persisted, so probably you want to make the container side
non-transient...<br>
<br>
<br>
Anthony wrote:
<blockquote cite="midXns990FD32108BCCAnthonyLee@206.191.52.34"
type="cite">
<pre wrap="">Merks,

Yes, both ends has explicit EReferences and the container side is
transient, both ends are not proxy resolving.


The question is :

When I try to add new element which has set eContainer into resource
contents , the eContainer is removed by inverseAdd(). So I don't know
how to save these elements.


Anthony


</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

There isn't actually a question in your note so I'm not sure if you
are trying to ask one...

Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made both
ends proxy resolving?


Anthony wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I
choose
to change them to many-to-one's (so only persist the reference from
the child to the parent) and load the one-to-many relation (parent to
child) on demand through an explicit query (make the many-reference
from the parent to the child transient). Adding to the parent is then
done by setting the parent feature in the child.



Anthony






</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

I'm not sure I completely follow what you are asking (container is
set as transient implies you don't want to serialize it), but in the
XMI serialization, to serialize a reference to the container, you
need to define a non-transient container feature (i.e., an
EReference that's the eOpposite of the containment feature).


Anthony wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony






</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

This sounds like expected behavior. For non-proxy resolving


</pre>
</blockquote>
<pre wrap="">containment


</pre>
<blockquote type="cite">
<pre wrap="">reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an
EObject container and be contained directly by a resource's
getContents. Only for proxy resolving containment is it possible
to put a "child" in to


</pre>
</blockquote>
<pre wrap="">a


</pre>
<blockquote type="cite">
<pre wrap="">separate resource. Note that if Products parent is already in a
resource then product.eResource() will be non-null, and there is
no


</pre>
</blockquote>
<pre wrap="">need


</pre>
<blockquote type="cite">
<pre wrap="">to put the Product directly in the resource since it's indirectly
contained in the resource by virtue of the parent being contained
in a resource.

Anthony wrote:


</pre>
<blockquote type="cite">
<pre wrap="">Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony






</pre>
</blockquote>
</blockquote>
<pre wrap="">

</pre>
</blockquote>
<pre wrap="">Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
I'm not sure I completely follow what you are asking (container is
set as transient implies you don't want to serialize it), but in the
XMI serialization, to serialize a reference to the container, you
need to define a non-transient container feature (i.e., an
EReference that's the eOpposite of the containment feature).&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FC81B5A375AnthonyLee@206.191.52.34">"midXns990FC81B5A375AnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote
in &lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;containment
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies == true),
eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents.
Only for proxy resolving containment is it possible to put a "child"
in to
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;a
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products parent is
already in a
resource then product.eResource() will be non-null, and there is no
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;need
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource since
it's indirectly
contained in the resource by virtue of the parent being contained in
a resource.

Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------040705060809080707090006--


</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap="">
Attachment decoded: untitled-2.txt
--------------010208080105080404000706
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
There isn't actually a question in your note so I'm not sure if you
are trying to ask one...&lt;br&gt;
&lt;br&gt;
Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made both
ends proxy resolving?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FCFB6F89BDAnthonyLee@206.191.52.34">"midXns990FCFB6F89BDAnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I
choose
to change them to many-to-one's (so only persist the reference from
the child to the parent) and load the one-to-many relation (parent to
child) on demand through an explicit query (make the many-reference
from the parent to the child transient). Adding to the parent is then
done by setting the parent feature in the child.



Anthony





&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).


Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt;
wrote in &lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony





&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;containment

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies == true),
eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents.
Only for proxy resolving containment is it possible to put a "child"
in to

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;a

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products parent
is already in a
resource then product.eResource() will be non-null, and there is no

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;need

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource since
it's indirectly
contained in the resource by virtue of the parent being contained in
a resource.

Anthony wrote:

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony





&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;
Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body bgcolor="#ffffff" text="#000000"&amp;gt;
Anthony,&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
I'm not sure I completely follow what you are asking (container is set
as transient implies you don't want to serialize it), but in the XMI
serialization, to serialize a reference to the container, you need to
define a non-transient container feature (i.e., an EReference that's
the eOpposite of the containment feature).&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
Anthony wrote:
&amp;lt;blockquote cite=&lt;a class="moz-txt-link-rfc2396E"
href="<a class="moz-txt-link-freetext" href="mailto:midXns990FC81B5A375AnthonyLee@">mailto:midXns990FC81B5A375AnthonyLee@ </a>
</pre>
</blockquote>
<pre wrap=""><!---->206.191.52.34"&gt;"midXns990FC8
</pre>
<blockquote type="cite">
<pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:1B5A375AnthonyLee@206.191.52.34">1B5A375AnthonyLee@206.191.52.34</a>"&lt;/a&gt;
type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Ed Merks &amp;lt;a class="moz-txt-link-rfc2396E"
href=&lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca..ibm.com">"mailto:merks@ca.ibm.com"</a>&lt;/a&gt;&amp;gt;
</pre>
</blockquote>
<pre wrap=""><!---->&amp;amp;
</pre>
<blockquote type="cite">
<pre wrap=""> <a class="moz-txt-link-abbreviated" href="mailto:lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt">lt;merks@ca.ibm.com&amp;amp;gt;&amp;lt;/a&amp;gt</a>; wrote in &amp;lt;a
class="moz-txt-link-freetext" href=&lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&lt;/a&gt;&amp;gt;&lt;a
class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;&amp;lt;/a&amp;gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;containment
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;reference (EReference.isResolveProxies ==
true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents. Only
for proxy resolving containment is it possible to put a "child" in to
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;a
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;separate resource. Note that if Products
parent is already in a
resource then product.eResource() will be non-null, and there is no
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;need
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;to put the Product directly in the resource
since it's indirectly
contained in the resource by virtue of the parent being contained in a
resource.

Anthony wrote:
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

Attachment decoded: untitled-3.htm
--------------040705060809080707090006--

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------010208080105080404000706--

</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------010504090600060301080902--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606685 is a reply to message #83310] Fri, 11 May 2007 14:12 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
I am not sure but does your first remark:

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

not already solve this issue? It seems like what Ed suggests.

gr. Martin

Ed Merks wrote:
> Anthony,
>
> If you really need the parent and the child to be in separate resources
> then you must make both ends proxy resolving, i.e., set
> EReference.isResolveProxies to true. And I'm not sure how Teneo
> handles it, but I imagine that a transient feature will not be
> persisted, so probably you want to make the container side non-transient...
>
>
> Anthony wrote:
>> Merks,
>>
>> Yes, both ends has explicit EReferences and the container side is
>> transient, both ends are not proxy resolving.
>>
>>
>> The question is :
>>
>> When I try to add new element which has set eContainer into resource
>> contents , the eContainer is removed by inverseAdd(). So I don't know
>> how to save these elements.
>>
>>
>> Anthony
>>
>>
>>
>>> Anthony,
>>>
>>> There isn't actually a question in your note so I'm not sure if you
>>> are trying to ask one...
>>>
>>> Do you have explicit EReferences for both ends of the relationship?
>>> Have you made the container side non-transient? And have you made both
>>> ends proxy resolving?
>>>
>>>
>>> Anthony wrote:
>>>
>>>> Merks,
>>>>
>>>> Actually I used Teneo to save my model into DB.
>>>>
>>>> Let me introduce the picture:
>>>>
>>>> When the first time the model is created , the only one
>>>> ProductRegistry element is created and saved.
>>>>
>>>> And then when user click the Product node in UI, I need to
>>>> show a table to list the products.
>>>>
>>>> Because the products collection could be really huge, so I
>>>> choose
>>>> to change them to many-to-one's (so only persist the reference from
>>>> the child to the parent) and load the one-to-many relation (parent to
>>>> child) on demand through an explicit query (make the many-reference
>>>> from the parent to the child transient). Adding to the parent is then
>>>> done by setting the parent feature in the child.
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Anthony,
>>>>>
>>>>> I'm not sure I completely follow what you are asking (container is
>>>>> set as transient implies you don't want to serialize it), but in the
>>>>> XMI serialization, to serialize a reference to the container, you
>>>>> need to define a non-transient container feature (i.e., an
>>>>> EReference that's the eOpposite of the containment feature).
>>>>>
>>>>>
>>>>> Anthony wrote:
>>>>>
>>>>>
>>>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>>>> @build.eclipse.org:
>>>>>>
>>>>>> Merks,
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> So if the container is set as transient, how to persist the
>>>>>> container's element ?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Anthony,
>>>>>>>
>>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> containment
>>>>>>
>>>>>>
>>>>>>
>>>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>>> EObject container and be contained directly by a resource's
>>>>>>> getContents. Only for proxy resolving containment is it possible
>>>>>>> to put a "child" in to
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> a
>>>>>>
>>>>>>
>>>>>>
>>>>>>> separate resource. Note that if Products parent is already in a
>>>>>>> resource then product.eResource() will be non-null, and there is
>>>>>>> no
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> need
>>>>>>
>>>>>>
>>>>>>
>>>>>>> to put the Product directly in the resource since it's indirectly
>>>>>>> contained in the resource by virtue of the parent being contained
>>>>>>> in a resource.
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>>
>>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>>
>>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>>> removal.
>>>>>>>>
>>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> Attachment decoded: untitled-2.txt
>>>>> --------------040705060809080707090006
>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>>> <html>
>>>>> <head>
>>>>> <meta content="text/html;charset=ISO-8859-1"
>>>>> http-equiv="Content-Type">
>>>>> </head>
>>>>> <body bgcolor="#ffffff" text="#000000">
>>>>> Anthony,<br>
>>>>> <br>
>>>>> I'm not sure I completely follow what you are asking (container is
>>>>> set as transient implies you don't want to serialize it), but in the
>>>>> XMI serialization, to serialize a reference to the container, you
>>>>> need to define a non-transient container feature (i.e., an
>>>>> EReference that's the eOpposite of the containment feature).<br>
>>>>> <br>
>>>>> <br>
>>>>> Anthony wrote:
>>>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>>>> type="cite">
>>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote
>>>>> in <a class="moz-txt-link-freetext"
>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>>> @build.eclipse.org:
>>>>>
>>>>> Merks,
>>>>>
>>>>> Thanks.
>>>>>
>>>>> So if the container is set as transient, how to persist the
>>>>> container's element ?
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Anthony,
>>>>>
>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->containment
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>>>> eContainer and
>>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>>> container and be contained directly by a resource's getContents.
>>>>> Only for proxy resolving containment is it possible to put a "child"
>>>>> in to
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->a
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">separate resource. Note that if Products parent is
>>>>> already in a
>>>>> resource then product.eResource() will be non-null, and there is no
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->need
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">to put the Product directly in the resource since
>>>>> it's indirectly
>>>>> contained in the resource by virtue of the parent being contained in
>>>>> a resource.
>>>>>
>>>>> Anthony wrote:
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Hi,
>>>>>
>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>> relationship and ProductRegistry set as transient.
>>>>>
>>>>> I create a new Product and set it's eContainer as not null
>>>>> and then add this Product element into HibernateResourse's
>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>
>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>> to make the isResolveProxy() return true, I could stop this removal.
>>>>>
>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->
>>>>> </pre>
>>>>> </blockquote>
>>>>> <br>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>> Attachment decoded: untitled-3.htm
>>>>> --------------040705060809080707090006--
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> Attachment decoded: untitled-2.txt
>>> --------------010208080105080404000706
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>> <html>
>>> <head>
>>> <meta content="text/html;charset=ISO-8859-1"
>>> http-equiv="Content-Type">
>>> </head>
>>> <body bgcolor="#ffffff" text="#000000">
>>> Anthony,<br>
>>> <br>
>>> There isn't actually a question in your note so I'm not sure if you
>>> are trying to ask one...<br>
>>> <br>
>>> Do you have explicit EReferences for both ends of the relationship?
>>> Have you made the container side non-transient? And have you made both
>>> ends proxy resolving?<br>
>>> <br>
>>> <br>
>>> Anthony wrote:
>>> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
>>> type="cite">
>>> <pre wrap="">Merks,
>>>
>>> Actually I used Teneo to save my model into DB.
>>>
>>> Let me introduce the picture:
>>>
>>> When the first time the model is created , the only one
>>> ProductRegistry element is created and saved.
>>>
>>> And then when user click the Product node in UI, I need to
>>> show a table to list the products.
>>>
>>> Because the products collection could be really huge, so I
>>> choose
>>> to change them to many-to-one's (so only persist the reference from
>>> the child to the parent) and load the one-to-many relation (parent to
>>> child) on demand through an explicit query (make the many-reference
>>> from the parent to the child transient). Adding to the parent is then
>>> done by setting the parent feature in the child.
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Anthony,
>>>
>>> I'm not sure I completely follow what you are asking (container is set
>>> as transient implies you don't want to serialize it), but in the XMI
>>> serialization, to serialize a reference to the container, you need to
>>> define a non-transient container feature (i.e., an EReference that's
>>> the eOpposite of the containment feature).
>>>
>>>
>>> Anthony wrote:
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>> wrote in <a class="moz-txt-link-freetext"
>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>> @build.eclipse.org:
>>>
>>> Merks,
>>>
>>> Thanks.
>>>
>>> So if the container is set as transient, how to persist the
>>> container's element ?
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Anthony,
>>>
>>> This sounds like expected behavior. For non-proxy resolving
>>>
>>> </pre>
>>> </blockquote>
>>> <pre wrap="">containment
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>> eContainer and
>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>> container and be contained directly by a resource's getContents.
>>> Only for proxy resolving containment is it possible to put a "child"
>>> in to
>>>
>>> </pre>
>>> </blockquote>
>>> <pre wrap="">a
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">separate resource. Note that if Products parent
>>> is already in a
>>> resource then product.eResource() will be non-null, and there is no
>>>
>>> </pre>
>>> </blockquote>
>>> <pre wrap="">need
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">to put the Product directly in the resource since
>>> it's indirectly
>>> contained in the resource by virtue of the parent being contained in
>>> a resource.
>>>
>>> Anthony wrote:
>>>
>>> </pre>
>>> <blockquote type="cite">
>>> <pre wrap="">Hi,
>>>
>>> In my EMF model , Product and ProductRegistry has many-To-one
>>> relationship and ProductRegistry set as transient.
>>>
>>> I create a new Product and set it's eContainer as not null
>>> and then add this Product element into HibernateResourse's
>>> contents, in inverseAdd() ,the eContainer is removed.
>>>
>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>> to make the isResolveProxy() return true, I could stop this
>>> removal.
>>>
>>> Do I need to set something in hibernate.hbm.xml?
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>
>>> </pre>
>>> </blockquote>
>>> </blockquote>
>>> <pre wrap="">
>>> </pre>
>>> </blockquote>
>>> <pre wrap="">
>>> Attachment decoded: untitled-2.txt
>>> --------------040705060809080707090006
>>> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
>>> &lt;html&gt;
>>> &lt;head&gt;
>>> &lt;meta content="text/html;charset=ISO-8859-1"
>>> http-equiv="Content-Type"&gt;
>>> &lt;/head&gt;
>>> &lt;body bgcolor="#ffffff" text="#000000"&gt;
>>> Anthony,&lt;br&gt;
>>> &lt;br&gt;
>>> I'm not sure I completely follow what you are asking (container is set
>>> as transient implies you don't want to serialize it), but in the XMI
>>> serialization, to serialize a reference to the container, you need to
>>> define a non-transient container feature (i.e., an EReference that's
>>> the eOpposite of the containment feature).&lt;br&gt;
>>> &lt;br&gt;
>>> &lt;br&gt;
>>> Anthony wrote:
>>> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
>>> href="mailto:midXns990FC81B5A375AnthonyLee@
>>>
>> 206.191.52.34">"midXns990FC8
>>
>>> 1B5A375AnthonyLee@206.191.52.34"</a>
>>> type="cite"&gt;
>>> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
>>> href=<a class="moz-txt-link-rfc2396E"
>>> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
>>>
>> &amp;
>>
>>> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
>>> class="moz-txt-link-freetext" href=<a class="moz-txt-link-rfc2396E"
>>> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
>>> class="moz-txt-link-freetext"
>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
>>> @build.eclipse.org:
>>>
>>> Merks,
>>>
>>> Thanks.
>>>
>>> So if the container is set as transient, how to persist the
>>> container's element ?
>>>
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;Anthony,
>>>
>>> This sounds like expected behavior. For non-proxy resolving
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;pre wrap=""&gt;&lt;!----&gt;containment
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
>>> true), eContainer and
>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>> container and be contained directly by a resource's getContents. Only
>>> for proxy resolving containment is it possible to put a "child" in to
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;pre wrap=""&gt;&lt;!----&gt;a
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;separate resource. Note that if Products
>>> parent is already in a
>>> resource then product.eResource() will be non-null, and there is no
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;pre wrap=""&gt;&lt;!----&gt;need
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;to put the Product directly in the resource
>>> since it's indirectly
>>> contained in the resource by virtue of the parent being contained in a
>>> resource.
>>>
>>> Anthony wrote:
>>> &lt;/pre&gt;
>>> &lt;blockquote type="cite"&gt;
>>> &lt;pre wrap=""&gt;Hi,
>>>
>>> In my EMF model , Product and ProductRegistry has many-To-one
>>> relationship and ProductRegistry set as transient.
>>>
>>> I create a new Product and set it's eContainer as not null
>>> and then add this Product element into HibernateResourse's
>>> contents, in inverseAdd() ,the eContainer is removed.
>>>
>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>> to make the isResolveProxy() return true, I could stop this removal.
>>>
>>> Do I need to set something in hibernate.hbm.xml?
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;/blockquote&gt;
>>> &lt;pre wrap=""&gt;&lt;!----&gt;
>>> &lt;/pre&gt;
>>> &lt;/blockquote&gt;
>>> &lt;br&gt;
>>> &lt;/body&gt;
>>> &lt;/html&gt;
>>>
>>> Attachment decoded: untitled-3.htm
>>> --------------040705060809080707090006--
>>>
>>> </pre>
>>> </blockquote>
>>> <pre wrap=""><!---->
>>> </pre>
>>> </blockquote>
>>> <br>
>>> </body>
>>> </html>
>>>
>>> Attachment decoded: untitled-3.htm
>>> --------------010208080105080404000706--
>>>
>>>
>>
>>
>


--

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: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606688 is a reply to message #83325] Sat, 12 May 2007 08:25 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

In my xxx.genmodel's properties, there is 'Contaiment Proxies'
property in 'Model' section, the description for this property
is "Whether to respect the resolveProxies setting for containment
references" and its default value is 'false'.

After I changed this value as 'true' , everything is OK.

Thanks .


Anthony

> Anthony,
> I am not sure but does your first remark:
>
> If I set the referenceFeature's proxyFlag as 65536 in debug mode
> to make the isResolveProxy() return true, I could stop this removal.
>
> not already solve this issue? It seems like what Ed suggests.
>
> gr. Martin
>
> Ed Merks wrote:
>> Anthony,
>>
>> If you really need the parent and the child to be in separate
>> resources then you must make both ends proxy resolving, i.e., set
>> EReference.isResolveProxies to true. And I'm not sure how Teneo
>> handles it, but I imagine that a transient feature will not be
>> persisted, so probably you want to make the container side
>> non-transient...
>>
>>
>> Anthony wrote:
>>> Merks,
>>>
>>> Yes, both ends has explicit EReferences and the container side is
>>> transient, both ends are not proxy resolving.
>>>
>>>
>>> The question is :
>>>
>>> When I try to add new element which has set eContainer into
>>> resource
>>> contents , the eContainer is removed by inverseAdd(). So I don't
>>> know how to save these elements.
>>>
>>>
>>> Anthony
>>>
>>>
>>>
>>>> Anthony,
>>>>
>>>> There isn't actually a question in your note so I'm not sure if you
>>>> are trying to ask one...
>>>>
>>>> Do you have explicit EReferences for both ends of the relationship?
>>>> Have you made the container side non-transient? And have you made
>>>> both ends proxy resolving?
>>>>
>>>>
>>>> Anthony wrote:
>>>>
>>>>> Merks,
>>>>>
>>>>> Actually I used Teneo to save my model into DB.
>>>>>
>>>>> Let me introduce the picture:
>>>>>
>>>>> When the first time the model is created , the only one
>>>>> ProductRegistry element is created and saved.
>>>>>
>>>>> And then when user click the Product node in UI, I need to
>>>>> show a table to list the products.
>>>>>
>>>>> Because the products collection could be really huge, so I
>>>>> choose
>>>>> to change them to many-to-one's (so only persist the reference
>>>>> from the child to the parent) and load the one-to-many relation
>>>>> (parent to child) on demand through an explicit query (make the
>>>>> many-reference from the parent to the child transient). Adding to
>>>>> the parent is then done by setting the parent feature in the
>>>>> child.
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Anthony,
>>>>>>
>>>>>> I'm not sure I completely follow what you are asking (container
>>>>>> is set as transient implies you don't want to serialize it), but
>>>>>> in the XMI serialization, to serialize a reference to the
>>>>>> container, you need to define a non-transient container feature
>>>>>> (i.e., an EReference that's the eOpposite of the containment
>>>>>> feature).
>>>>>>
>>>>>>
>>>>>> Anthony wrote:
>>>>>>
>>>>>>
>>>>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>>>>> @build.eclipse.org:
>>>>>>>
>>>>>>> Merks,
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> So if the container is set as transient, how to persist the
>>>>>>> container's element ?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Anthony,
>>>>>>>>
>>>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> containment
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>>>> EObject container and be contained directly by a resource's
>>>>>>>> getContents. Only for proxy resolving containment is it
>>>>>>>> possible to put a "child" in to
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> a
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> separate resource. Note that if Products parent is already in
>>>>>>>> a resource then product.eResource() will be non-null, and there
>>>>>>>> is no
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> need
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> to put the Product directly in the resource since it's
>>>>>>>> indirectly contained in the resource by virtue of the parent
>>>>>>>> being contained in a resource.
>>>>>>>>
>>>>>>>> Anthony wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> In my EMF model , Product and ProductRegistry has
>>>>>>>>> many-To-one
>>>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>>>
>>>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>>>
>>>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug
>>>>>>>>> mode
>>>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>>>> removal.
>>>>>>>>>
>>>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> Attachment decoded: untitled-2.txt
>>>>>> --------------040705060809080707090006
>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>>>> <html>
>>>>>> <head>
>>>>>> <meta content="text/html;charset=ISO-8859-1"
>>>>>> http-equiv="Content-Type">
>>>>>> </head>
>>>>>> <body bgcolor="#ffffff" text="#000000">
>>>>>> Anthony,<br>
>>>>>> <br>
>>>>>> I'm not sure I completely follow what you are asking (container
>>>>>> is set as transient implies you don't want to serialize it), but
>>>>>> in the XMI serialization, to serialize a reference to the
>>>>>> container, you need to define a non-transient container feature
>>>>>> (i.e., an EReference that's the eOpposite of the containment
>>>>>> feature).<br> <br>
>>>>>> <br>
>>>>>> Anthony wrote:
>>>>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>>>>> type="cite">
>>>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>>>>> wrote in <a class="moz-txt-link-freetext"
>>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>>>> @build.eclipse.org:
>>>>>>
>>>>>> Merks,
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> So if the container is set as transient, how to persist the
>>>>>> container's element ?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">Anthony,
>>>>>>
>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> <pre wrap=""><!---->containment
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>>>>> eContainer and
>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>> EObject container and be contained directly by a resource's
>>>>>> getContents. Only for proxy resolving containment is it possible
>>>>>> to put a "child" in to
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> <pre wrap=""><!---->a
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">separate resource. Note that if Products parent
>>>>>> is already in a
>>>>>> resource then product.eResource() will be non-null, and there is
>>>>>> no
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> <pre wrap=""><!---->need
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">to put the Product directly in the resource
>>>>>> since it's indirectly
>>>>>> contained in the resource by virtue of the parent being contained
>>>>>> in a resource.
>>>>>>
>>>>>> Anthony wrote:
>>>>>> </pre>
>>>>>> <blockquote type="cite">
>>>>>> <pre wrap="">Hi,
>>>>>>
>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>> relationship and ProductRegistry set as transient.
>>>>>>
>>>>>> I create a new Product and set it's eContainer as not null
>>>>>> and then add this Product element into HibernateResourse's
>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>
>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>> removal.
>>>>>>
>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> </blockquote>
>>>>>> <pre wrap=""><!---->
>>>>>> </pre>
>>>>>> </blockquote>
>>>>>> <br>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>> Attachment decoded: untitled-3.htm
>>>>>> --------------040705060809080707090006--
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>> Attachment decoded: untitled-2.txt
>>>> --------------010208080105080404000706
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>> <html>
>>>> <head>
>>>> <meta content="text/html;charset=ISO-8859-1"
>>>> http-equiv="Content-Type">
>>>> </head>
>>>> <body bgcolor="#ffffff" text="#000000">
>>>> Anthony,<br>
>>>> <br>
>>>> There isn't actually a question in your note so I'm not sure if you
>>>> are trying to ask one...<br>
>>>> <br>
>>>> Do you have explicit EReferences for both ends of the relationship?
>>>> Have you made the container side non-transient? And have you made
>>>> both ends proxy resolving?<br>
>>>> <br>
>>>> <br>
>>>> Anthony wrote:
>>>> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
>>>> type="cite">
>>>> <pre wrap="">Merks,
>>>>
>>>> Actually I used Teneo to save my model into DB.
>>>>
>>>> Let me introduce the picture:
>>>>
>>>> When the first time the model is created , the only one
>>>> ProductRegistry element is created and saved.
>>>>
>>>> And then when user click the Product node in UI, I need to
>>>> show a table to list the products.
>>>>
>>>> Because the products collection could be really huge, so I
>>>> choose
>>>> to change them to many-to-one's (so only persist the reference from
>>>> the child to the parent) and load the one-to-many relation (parent
>>>> to child) on demand through an explicit query (make the
>>>> many-reference from the parent to the child transient). Adding to
>>>> the parent is then done by setting the parent feature in the child.
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Anthony,
>>>>
>>>> I'm not sure I completely follow what you are asking (container is
>>>> set as transient implies you don't want to serialize it), but in
>>>> the XMI serialization, to serialize a reference to the container,
>>>> you need to define a non-transient container feature (i.e., an
>>>> EReference that's the eOpposite of the containment feature).
>>>>
>>>>
>>>> Anthony wrote:
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>>> wrote in <a class="moz-txt-link-freetext"
>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>> @build.eclipse.org:
>>>>
>>>> Merks,
>>>>
>>>> Thanks.
>>>>
>>>> So if the container is set as transient, how to persist the
>>>> container's element ?
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Anthony,
>>>>
>>>> This sounds like expected behavior. For non-proxy resolving
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap="">containment
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">reference (EReference.isResolveProxies ==
>>>> true), eContainer and
>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>> container and be contained directly by a resource's getContents.
>>>> Only for proxy resolving containment is it possible to put a
>>>> "child" in to
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap="">a
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">separate resource. Note that if Products
>>>> parent is already in a
>>>> resource then product.eResource() will be non-null, and there is no
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap="">need
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">to put the Product directly in the resource
>>>> since it's indirectly
>>>> contained in the resource by virtue of the parent being contained
>>>> in a resource.
>>>>
>>>> Anthony wrote:
>>>>
>>>> </pre>
>>>> <blockquote type="cite">
>>>> <pre wrap="">Hi,
>>>>
>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>> relationship and ProductRegistry set as transient.
>>>>
>>>> I create a new Product and set it's eContainer as not null
>>>> and then add this Product element into HibernateResourse's
>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>
>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>> to make the isResolveProxy() return true, I could stop this
>>>> removal.
>>>>
>>>> Do I need to set something in hibernate.hbm.xml?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> </blockquote>
>>>> <pre wrap="">
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap="">
>>>> Attachment decoded: untitled-2.txt
>>>> --------------040705060809080707090006
>>>> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
>>>> Transitional//EN"&gt; &lt;html&gt;
>>>> &lt;head&gt;
>>>> &lt;meta content="text/html;charset=ISO-8859-1"
>>>> http-equiv="Content-Type"&gt;
>>>> &lt;/head&gt;
>>>> &lt;body bgcolor="#ffffff" text="#000000"&gt;
>>>> Anthony,&lt;br&gt;
>>>> &lt;br&gt;
>>>> I'm not sure I completely follow what you are asking (container is
>>>> set as transient implies you don't want to serialize it), but in
>>>> the XMI serialization, to serialize a reference to the container,
>>>> you need to define a non-transient container feature (i.e., an
>>>> EReference that's the eOpposite of the containment
>>>> feature).&lt;br&gt; &lt;br&gt;
>>>> &lt;br&gt;
>>>> Anthony wrote:
>>>> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
>>>> href="mailto:midXns990FC81B5A375AnthonyLee@
>>>>
>>> 206.191.52.34">"midXns990FC8
>>>
>>>> 1B5A375AnthonyLee@206.191.52.34"</a>
>>>> type="cite"&gt;
>>>> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
>>>> href=<a class="moz-txt-link-rfc2396E"
>>>> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
>>>>
>>> &amp;
>>>
>>>> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
>>>> class="moz-txt-link-freetext" href=<a
>>>> class="moz-txt-link-rfc2396E"
>>>> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
>>>> class="moz-txt-link-freetext"
>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
>>>> @build.eclipse.org:
>>>>
>>>> Merks,
>>>>
>>>> Thanks.
>>>>
>>>> So if the container is set as transient, how to persist the
>>>> container's element ?
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;Anthony,
>>>>
>>>> This sounds like expected behavior. For non-proxy resolving
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;pre wrap=""&gt;&lt;!----&gt;containment
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
>>>> true), eContainer and
>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>> container and be contained directly by a resource's getContents.
>>>> Only for proxy resolving containment is it possible to put a
>>>> "child" in to
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;pre wrap=""&gt;&lt;!----&gt;a
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;separate resource. Note that if Products
>>>> parent is already in a
>>>> resource then product.eResource() will be non-null, and there is no
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;pre wrap=""&gt;&lt;!----&gt;need
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;to put the Product directly in the resource
>>>> since it's indirectly
>>>> contained in the resource by virtue of the parent being contained
>>>> in a resource.
>>>>
>>>> Anthony wrote:
>>>> &lt;/pre&gt;
>>>> &lt;blockquote type="cite"&gt;
>>>> &lt;pre wrap=""&gt;Hi,
>>>>
>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>> relationship and ProductRegistry set as transient.
>>>>
>>>> I create a new Product and set it's eContainer as not null
>>>> and then add this Product element into HibernateResourse's
>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>
>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>> to make the isResolveProxy() return true, I could stop this
>>>> removal.
>>>>
>>>> Do I need to set something in hibernate.hbm.xml?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;pre wrap=""&gt;&lt;!----&gt;
>>>> &lt;/pre&gt;
>>>> &lt;/blockquote&gt;
>>>> &lt;br&gt;
>>>> &lt;/body&gt;
>>>> &lt;/html&gt;
>>>>
>>>> Attachment decoded: untitled-3.htm
>>>> --------------040705060809080707090006--
>>>>
>>>> </pre>
>>>> </blockquote>
>>>> <pre wrap=""><!---->
>>>> </pre>
>>>> </blockquote>
>>>> <br>
>>>> </body>
>>>> </html>
>>>>
>>>> Attachment decoded: untitled-3.htm
>>>> --------------010208080105080404000706--
>>>>
>>>>
>>>
>>>
>>
>
>
Re: [teneo] eContainer is set null in inverseAdd() when adding new element into Resource's contentEL [message #606689 is a reply to message #83367] Sat, 12 May 2007 11:17 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030303050303080507020407
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anthony,

Sorry, I really should have thought to mention that. :-(


Anthony wrote:
> Martin,
>
> In my xxx.genmodel's properties, there is 'Contaiment Proxies'
> property in 'Model' section, the description for this property
> is "Whether to respect the resolveProxies setting for containment
> references" and its default value is 'false'.
>
> After I changed this value as 'true' , everything is OK.
>
> Thanks .
>
>
> Anthony
>
>
>> Anthony,
>> I am not sure but does your first remark:
>>
>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>> to make the isResolveProxy() return true, I could stop this removal.
>>
>> not already solve this issue? It seems like what Ed suggests.
>>
>> gr. Martin
>>
>> Ed Merks wrote:
>>
>>> Anthony,
>>>
>>> If you really need the parent and the child to be in separate
>>> resources then you must make both ends proxy resolving, i.e., set
>>> EReference.isResolveProxies to true. And I'm not sure how Teneo
>>> handles it, but I imagine that a transient feature will not be
>>> persisted, so probably you want to make the container side
>>> non-transient...
>>>
>>>
>>> Anthony wrote:
>>>
>>>> Merks,
>>>>
>>>> Yes, both ends has explicit EReferences and the container side is
>>>> transient, both ends are not proxy resolving.
>>>>
>>>>
>>>> The question is :
>>>>
>>>> When I try to add new element which has set eContainer into
>>>> resource
>>>> contents , the eContainer is removed by inverseAdd(). So I don't
>>>> know how to save these elements.
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>> Anthony,
>>>>>
>>>>> There isn't actually a question in your note so I'm not sure if you
>>>>> are trying to ask one...
>>>>>
>>>>> Do you have explicit EReferences for both ends of the relationship?
>>>>> Have you made the container side non-transient? And have you made
>>>>> both ends proxy resolving?
>>>>>
>>>>>
>>>>> Anthony wrote:
>>>>>
>>>>>
>>>>>> Merks,
>>>>>>
>>>>>> Actually I used Teneo to save my model into DB.
>>>>>>
>>>>>> Let me introduce the picture:
>>>>>>
>>>>>> When the first time the model is created , the only one
>>>>>> ProductRegistry element is created and saved.
>>>>>>
>>>>>> And then when user click the Product node in UI, I need to
>>>>>> show a table to list the products.
>>>>>>
>>>>>> Because the products collection could be really huge, so I
>>>>>> choose
>>>>>> to change them to many-to-one's (so only persist the reference
>>>>>> from the child to the parent) and load the one-to-many relation
>>>>>> (parent to child) on demand through an explicit query (make the
>>>>>> many-reference from the parent to the child transient). Adding to
>>>>>> the parent is then done by setting the parent feature in the
>>>>>> child.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Anthony,
>>>>>>>
>>>>>>> I'm not sure I completely follow what you are asking (container
>>>>>>> is set as transient implies you don't want to serialize it), but
>>>>>>> in the XMI serialization, to serialize a reference to the
>>>>>>> container, you need to define a non-transient container feature
>>>>>>> (i.e., an EReference that's the eOpposite of the containment
>>>>>>> feature).
>>>>>>>
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Ed Merks <merks@ca.ibm.com> wrote in news:f21jgu$ihr$1
>>>>>>>> @build.eclipse.org:
>>>>>>>>
>>>>>>>> Merks,
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> So if the container is set as transient, how to persist the
>>>>>>>> container's element ?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Anthony,
>>>>>>>>>
>>>>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> containment
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> reference (EReference.isResolveProxies == true), eContainer and
>>>>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>>>>> EObject container and be contained directly by a resource's
>>>>>>>>> getContents. Only for proxy resolving containment is it
>>>>>>>>> possible to put a "child" in to
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> a
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> separate resource. Note that if Products parent is already in
>>>>>>>>> a resource then product.eResource() will be non-null, and there
>>>>>>>>> is no
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> need
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> to put the Product directly in the resource since it's
>>>>>>>>> indirectly contained in the resource by virtue of the parent
>>>>>>>>> being contained in a resource.
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> In my EMF model , Product and ProductRegistry has
>>>>>>>>>> many-To-one
>>>>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>>>>
>>>>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>>>>
>>>>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug
>>>>>>>>>> mode
>>>>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>>>>> removal.
>>>>>>>>>>
>>>>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> Attachment decoded: untitled-2.txt
>>>>>>> --------------040705060809080707090006
>>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>>>>> <html>
>>>>>>> <head>
>>>>>>> <meta content="text/html;charset=ISO-8859-1"
>>>>>>> http-equiv="Content-Type">
>>>>>>> </head>
>>>>>>> <body bgcolor="#ffffff" text="#000000">
>>>>>>> Anthony,<br>
>>>>>>> <br>
>>>>>>> I'm not sure I completely follow what you are asking (container
>>>>>>> is set as transient implies you don't want to serialize it), but
>>>>>>> in the XMI serialization, to serialize a reference to the
>>>>>>> container, you need to define a non-transient container feature
>>>>>>> (i.e., an EReference that's the eOpposite of the containment
>>>>>>> feature).<br> <br>
>>>>>>> <br>
>>>>>>> Anthony wrote:
>>>>>>> <blockquote cite="midXns990FC81B5A375AnthonyLee@206.191.52.34"
>>>>>>> type="cite">
>>>>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>>>>>> wrote in <a class="moz-txt-link-freetext"
>>>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>>>>> @build.eclipse.org:
>>>>>>>
>>>>>>> Merks,
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> So if the container is set as transient, how to persist the
>>>>>>> container's element ?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">Anthony,
>>>>>>>
>>>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> <pre wrap=""><!---->containment
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">reference (EReference.isResolveProxies == true),
>>>>>>> eContainer and
>>>>>>> eDirectResource mutually exclusive, i.e., you can't have an
>>>>>>> EObject container and be contained directly by a resource's
>>>>>>> getContents. Only for proxy resolving containment is it possible
>>>>>>> to put a "child" in to
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> <pre wrap=""><!---->a
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">separate resource. Note that if Products parent
>>>>>>> is already in a
>>>>>>> resource then product.eResource() will be non-null, and there is
>>>>>>> no
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> <pre wrap=""><!---->need
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">to put the Product directly in the resource
>>>>>>> since it's indirectly
>>>>>>> contained in the resource by virtue of the parent being contained
>>>>>>> in a resource.
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>> </pre>
>>>>>>> <blockquote type="cite">
>>>>>>> <pre wrap="">Hi,
>>>>>>>
>>>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>>>> relationship and ProductRegistry set as transient.
>>>>>>>
>>>>>>> I create a new Product and set it's eContainer as not null
>>>>>>> and then add this Product element into HibernateResourse's
>>>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>>>
>>>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>>>> to make the isResolveProxy() return true, I could stop this
>>>>>>> removal.
>>>>>>>
>>>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> </blockquote>
>>>>>>> <pre wrap=""><!---->
>>>>>>> </pre>
>>>>>>> </blockquote>
>>>>>>> <br>
>>>>>>> </body>
>>>>>>> </html>
>>>>>>>
>>>>>>> Attachment decoded: untitled-3.htm
>>>>>>> --------------040705060809080707090006--
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> Attachment decoded: untitled-2.txt
>>>>> --------------010208080105080404000706
>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>>>> <html>
>>>>> <head>
>>>>> <meta content="text/html;charset=ISO-8859-1"
>>>>> http-equiv="Content-Type">
>>>>> </head>
>>>>> <body bgcolor="#ffffff" text="#000000">
>>>>> Anthony,<br>
>>>>> <br>
>>>>> There isn't actually a question in your note so I'm not sure if you
>>>>> are trying to ask one...<br>
>>>>> <br>
>>>>> Do you have explicit EReferences for both ends of the relationship?
>>>>> Have you made the container side non-transient? And have you made
>>>>> both ends proxy resolving?<br>
>>>>> <br>
>>>>> <br>
>>>>> Anthony wrote:
>>>>> <blockquote cite="midXns990FCFB6F89BDAnthonyLee@206.191.52.34"
>>>>> type="cite">
>>>>> <pre wrap="">Merks,
>>>>>
>>>>> Actually I used Teneo to save my model into DB.
>>>>>
>>>>> Let me introduce the picture:
>>>>>
>>>>> When the first time the model is created , the only one
>>>>> ProductRegistry element is created and saved.
>>>>>
>>>>> And then when user click the Product node in UI, I need to
>>>>> show a table to list the products.
>>>>>
>>>>> Because the products collection could be really huge, so I
>>>>> choose
>>>>> to change them to many-to-one's (so only persist the reference from
>>>>> the child to the parent) and load the one-to-many relation (parent
>>>>> to child) on demand through an explicit query (make the
>>>>> many-reference from the parent to the child transient). Adding to
>>>>> the parent is then done by setting the parent feature in the child.
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Anthony,
>>>>>
>>>>> I'm not sure I completely follow what you are asking (container is
>>>>> set as transient implies you don't want to serialize it), but in
>>>>> the XMI serialization, to serialize a reference to the container,
>>>>> you need to define a non-transient container feature (i.e., an
>>>>> EReference that's the eOpposite of the containment feature).
>>>>>
>>>>>
>>>>> Anthony wrote:
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E"
>>>>> href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a>
>>>>> wrote in <a class="moz-txt-link-freetext"
>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
>>>>> @build.eclipse.org:
>>>>>
>>>>> Merks,
>>>>>
>>>>> Thanks.
>>>>>
>>>>> So if the container is set as transient, how to persist the
>>>>> container's element ?
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Anthony,
>>>>>
>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap="">containment
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">reference (EReference.isResolveProxies ==
>>>>> true), eContainer and
>>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>>> container and be contained directly by a resource's getContents.
>>>>> Only for proxy resolving containment is it possible to put a
>>>>> "child" in to
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap="">a
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">separate resource. Note that if Products
>>>>> parent is already in a
>>>>> resource then product.eResource() will be non-null, and there is no
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap="">need
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">to put the Product directly in the resource
>>>>> since it's indirectly
>>>>> contained in the resource by virtue of the parent being contained
>>>>> in a resource.
>>>>>
>>>>> Anthony wrote:
>>>>>
>>>>> </pre>
>>>>> <blockquote type="cite">
>>>>> <pre wrap="">Hi,
>>>>>
>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>> relationship and ProductRegistry set as transient.
>>>>>
>>>>> I create a new Product and set it's eContainer as not null
>>>>> and then add this Product element into HibernateResourse's
>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>
>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>> to make the isResolveProxy() return true, I could stop this
>>>>> removal.
>>>>>
>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> </blockquote>
>>>>> <pre wrap="">
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap="">
>>>>> Attachment decoded: untitled-2.txt
>>>>> --------------040705060809080707090006
>>>>> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
>>>>> Transitional//EN"&gt; &lt;html&gt;
>>>>> &lt;head&gt;
>>>>> &lt;meta content="text/html;charset=ISO-8859-1"
>>>>> http-equiv="Content-Type"&gt;
>>>>> &lt;/head&gt;
>>>>> &lt;body bgcolor="#ffffff" text="#000000"&gt;
>>>>> Anthony,&lt;br&gt;
>>>>> &lt;br&gt;
>>>>> I'm not sure I completely follow what you are asking (container is
>>>>> set as transient implies you don't want to serialize it), but in
>>>>> the XMI serialization, to serialize a reference to the container,
>>>>> you need to define a non-transient container feature (i.e., an
>>>>> EReference that's the eOpposite of the containment
>>>>> feature).&lt;br&gt; &lt;br&gt;
>>>>> &lt;br&gt;
>>>>> Anthony wrote:
>>>>> &lt;blockquote cite=<a class="moz-txt-link-rfc2396E"
>>>>> href="mailto:midXns990FC81B5A375AnthonyLee@
>>>>>
>>>>>
>>>> 206.191.52.34">"midXns990FC8
>>>>
>>>>
>>>>> 1B5A375AnthonyLee@206.191.52.34"</a>
>>>>> type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
>>>>> href=<a class="moz-txt-link-rfc2396E"
>>>>> href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;
>>>>>
>>>>>
>>>> &amp;
>>>>
>>>>
>>>>> lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt; wrote in &lt;a
>>>>> class="moz-txt-link-freetext" href=<a
>>>>> class="moz-txt-link-rfc2396E"
>>>>> href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a
>>>>> class="moz-txt-link-freetext"
>>>>> href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
>>>>> @build.eclipse.org:
>>>>>
>>>>> Merks,
>>>>>
>>>>> Thanks.
>>>>>
>>>>> So if the container is set as transient, how to persist the
>>>>> container's element ?
>>>>>
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;Anthony,
>>>>>
>>>>> This sounds like expected behavior. For non-proxy resolving
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;pre wrap=""&gt;&lt;!----&gt;containment
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
>>>>> true), eContainer and
>>>>> eDirectResource mutually exclusive, i.e., you can't have an EObject
>>>>> container and be contained directly by a resource's getContents.
>>>>> Only for proxy resolving containment is it possible to put a
>>>>> "child" in to
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;pre wrap=""&gt;&lt;!----&gt;a
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;separate resource. Note that if Products
>>>>> parent is already in a
>>>>> resource then product.eResource() will be non-null, and there is no
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;pre wrap=""&gt;&lt;!----&gt;need
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;to put the Product directly in the resource
>>>>> since it's indirectly
>>>>> contained in the resource by virtue of the parent being contained
>>>>> in a resource.
>>>>>
>>>>> Anthony wrote:
>>>>> &lt;/pre&gt;
>>>>> &lt;blockquote type="cite"&gt;
>>>>> &lt;pre wrap=""&gt;Hi,
>>>>>
>>>>> In my EMF model , Product and ProductRegistry has many-To-one
>>>>> relationship and ProductRegistry set as transient.
>>>>>
>>>>> I create a new Product and set it's eContainer as not null
>>>>> and then add this Product element into HibernateResourse's
>>>>> contents, in inverseAdd() ,the eContainer is removed.
>>>>>
>>>>> If I set the referenceFeature's proxyFlag as 65536 in debug mode
>>>>> to make the isResolveProxy() return true, I could stop this
>>>>> removal.
>>>>>
>>>>> Do I need to set something in hibernate.hbm.xml?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;pre wrap=""&gt;&lt;!----&gt;
>>>>> &lt;/pre&gt;
>>>>> &lt;/blockquote&gt;
>>>>> &lt;br&gt;
>>>>> &lt;/body&gt;
>>>>> &lt;/html&gt;
>>>>>
>>>>> Attachment decoded: untitled-3.htm
>>>>> --------------040705060809080707090006--
>>>>>
>>>>> </pre>
>>>>> </blockquote>
>>>>> <pre wrap=""><!---->
>>>>> </pre>
>>>>> </blockquote>
>>>>> <br>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>> Attachment decoded: untitled-3.htm
>>>>> --------------010208080105080404000706--
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>
>
>


--------------030303050303080507020407
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Anthony,<br>
<br>
Sorry, I really should have thought to mention that.&nbsp; :-(<br>
<br>
<br>
Anthony wrote:
<blockquote cite="midXns992EA6DCB84CDAnthonyLee@206.191.52.34"
type="cite">
<pre wrap="">Martin,

In my xxx.genmodel's properties, there is 'Contaiment Proxies'
property in 'Model' section, the description for this property
is "Whether to respect the resolveProxies setting for containment
references" and its default value is 'false'.

After I changed this value as 'true' , everything is OK.

Thanks .


Anthony

</pre>
<blockquote type="cite">
<pre wrap="">Anthony,
I am not sure but does your first remark:

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this removal.

not already solve this issue? It seems like what Ed suggests.

gr. Martin

Ed Merks wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

If you really need the parent and the child to be in separate
resources then you must make both ends proxy resolving, i.e., set
EReference.isResolveProxies to true. And I'm not sure how Teneo
handles it, but I imagine that a transient feature will not be
persisted, so probably you want to make the container side
non-transient...


Anthony wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Merks,

Yes, both ends has explicit EReferences and the container side is
transient, both ends are not proxy resolving.


The question is :

When I try to add new element which has set eContainer into
resource
contents , the eContainer is removed by inverseAdd(). So I don't
know how to save these elements.


Anthony



</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

There isn't actually a question in your note so I'm not sure if you
are trying to ask one...

Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made
both ends proxy resolving?


Anthony wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I
choose
to change them to many-to-one's (so only persist the reference
from the child to the parent) and load the one-to-many relation
(parent to child) on demand through an explicit query (make the
many-reference from the parent to the child transient). Adding to
the parent is then done by setting the parent feature in the
child.



Anthony







</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

I'm not sure I completely follow what you are asking (container
is set as transient implies you don't want to serialize it), but
in the XMI serialization, to serialize a reference to the
container, you need to define a non-transient container feature
(i.e., an EReference that's the eOpposite of the containment
feature).


Anthony wrote:


</pre>
<blockquote type="cite">
<pre wrap="">Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony







</pre>
<blockquote type="cite">
<pre wrap="">Anthony,

This sounds like expected behavior. For non-proxy resolving



</pre>
</blockquote>
<pre wrap="">containment



</pre>
<blockquote type="cite">
<pre wrap="">reference (EReference.isResolveProxies == true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an
EObject container and be contained directly by a resource's
getContents. Only for proxy resolving containment is it
possible to put a "child" in to



</pre>
</blockquote>
<pre wrap="">a



</pre>
<blockquote type="cite">
<pre wrap="">separate resource. Note that if Products parent is already in
a resource then product.eResource() will be non-null, and there
is no



</pre>
</blockquote>
<pre wrap="">need



</pre>
<blockquote type="cite">
<pre wrap="">to put the Product directly in the resource since it's
indirectly contained in the resource by virtue of the parent
being contained in a resource.

Anthony wrote:



</pre>
<blockquote type="cite">
<pre wrap="">Hi,

In my EMF model , Product and ProductRegistry has
many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug
mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony







</pre>
</blockquote>
</blockquote>
<pre wrap="">


</pre>
</blockquote>
<pre wrap="">Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
I'm not sure I completely follow what you are asking (container
is set as transient implies you don't want to serialize it), but
in the XMI serialization, to serialize a reference to the
container, you need to define a non-transient container feature
(i.e., an EReference that's the eOpposite of the containment
feature).&lt;br&gt; &lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FC81B5A375AnthonyLee@206.191.52.34">"midXns990FC81B5A375AnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt;
wrote in &lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;containment
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies == true),
eContainer and
eDirectResource mutually exclusive, i.e., you can't have an
EObject container and be contained directly by a resource's
getContents. Only for proxy resolving containment is it possible
to put a "child" in to
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;a
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products parent
is already in a
resource then product.eResource() will be non-null, and there is
no
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;need
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource
since it's indirectly
contained in the resource by virtue of the parent being contained
in a resource.

Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony




&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;&lt;!----&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;

Attachment decoded: untitled-3.htm
--------------040705060809080707090006--



</pre>
</blockquote>
<pre wrap="">

</pre>
</blockquote>
<pre wrap="">Attachment decoded: untitled-2.txt
--------------010208080105080404000706
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&gt;
&lt;/head&gt;
&lt;body bgcolor="#ffffff" text="#000000"&gt;
Anthony,&lt;br&gt;
&lt;br&gt;
There isn't actually a question in your note so I'm not sure if you
are trying to ask one...&lt;br&gt;
&lt;br&gt;
Do you have explicit EReferences for both ends of the relationship?
Have you made the container side non-transient? And have you made
both ends proxy resolving?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anthony wrote:
&lt;blockquote cite=<a class="moz-txt-link-rfc2396E" href="mailto:midXns990FCFB6F89BDAnthonyLee@206.191.52.34">"midXns990FCFB6F89BDAnthonyLee@206.191.52.34"</a>
type="cite"&gt;
&lt;pre wrap=""&gt;Merks,

Actually I used Teneo to save my model into DB.

Let me introduce the picture:

When the first time the model is created , the only one
ProductRegistry element is created and saved.

And then when user click the Product node in UI, I need to
show a table to list the products.

Because the products collection could be really huge, so I
choose
to change them to many-to-one's (so only persist the reference from
the child to the parent) and load the one-to-many relation (parent
to child) on demand through an explicit query (make the
many-reference from the parent to the child transient). Adding to
the parent is then done by setting the parent feature in the child.



Anthony





&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

I'm not sure I completely follow what you are asking (container is
set as transient implies you don't want to serialize it), but in
the XMI serialization, to serialize a reference to the container,
you need to define a non-transient container feature (i.e., an
EReference that's the eOpposite of the containment feature).


Anthony wrote:
&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Ed Merks &lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;&amp;lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt;
wrote in &lt;a class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony





&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Anthony,

This sounds like expected behavior. For non-proxy resolving

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;containment

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;reference (EReference.isResolveProxies ==
true), eContainer and
eDirectResource mutually exclusive, i.e., you can't have an EObject
container and be contained directly by a resource's getContents.
Only for proxy resolving containment is it possible to put a
"child" in to

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;a

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;separate resource. Note that if Products
parent is already in a
resource then product.eResource() will be non-null, and there is no

&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;need

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;to put the Product directly in the resource
since it's indirectly
contained in the resource by virtue of the parent being contained
in a resource.

Anthony wrote:

&lt;/pre&gt;
&lt;blockquote type="cite"&gt;
&lt;pre wrap=""&gt;Hi,

In my EMF model , Product and ProductRegistry has many-To-one
relationship and ProductRegistry set as transient.

I create a new Product and set it's eContainer as not null
and then add this Product element into HibernateResourse's
contents, in inverseAdd() ,the eContainer is removed.

If I set the referenceFeature's proxyFlag as 65536 in debug mode
to make the isResolveProxy() return true, I could stop this
removal.

Do I need to set something in hibernate.hbm.xml?

Anthony





&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre wrap=""&gt;
Attachment decoded: untitled-2.txt
--------------040705060809080707090006
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"&amp;gt; &amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body bgcolor="#ffffff" text="#000000"&amp;gt;
Anthony,&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
I'm not sure I completely follow what you are asking (container is
set as transient implies you don't want to serialize it), but in
the XMI serialization, to serialize a reference to the container,
you need to define a non-transient container feature (i.e., an
EReference that's the eOpposite of the containment
feature).&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
Anthony wrote:
&amp;lt;blockquote cite=&lt;a class="moz-txt-link-rfc2396E"
href="<a class="moz-txt-link-freetext" href="mailto:midXns990FC81B5A375AnthonyLee@">mailto:midXns990FC81B5A375AnthonyLee@ </a>

</pre>
</blockquote>
<pre wrap="">206.191.52.34"&gt;"midXns990FC8

</pre>
<blockquote type="cite">
<pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:1B5A375AnthonyLee@206.191.52.34">1B5A375AnthonyLee@206.191.52.34</a>"&lt;/a&gt;
type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Ed Merks &amp;lt;a class="moz-txt-link-rfc2396E"
href=&lt;a class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&gt;<a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">"mailto:merks@ca.ibm.com"</a>&lt;/a&gt;&amp;gt;

</pre>
</blockquote>
<pre wrap="">&amp;amp;

</pre>
<blockquote type="cite">
<pre wrap=""> <a class="moz-txt-link-abbreviated" href="mailto:lt;merks@ca.ibm.com&amp;gt;&lt;/a&gt">lt;merks@ca.ibm.com&amp;amp;gt;&amp;lt;/a&amp;gt</a>; wrote in &amp;lt;a
class="moz-txt-link-freetext" href=&lt;a
class="moz-txt-link-rfc2396E"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&lt;/a&gt;&amp;gt;&lt;a
class="moz-txt-link-freetext"
href=<a class="moz-txt-link-rfc2396E" href="news:f21jgu$ihr$1">"news:f21jgu$ihr$1"</a>&gt; <a class="moz-txt-link-freetext" href="news:f21jgu$ihr$1">news:f21jgu$ihr$1</a>&lt;/a&gt;&amp;lt;/a&amp;gt;
@build.eclipse.org:

Merks,

Thanks.

So if the container is set as transient, how to persist the
container's element ?



Anthony




&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"&amp;gt;
&amp;lt;pre wrap=""&amp;gt;Anthony,

This sounds like expected behavior. For non-proxy resolving
&amp;lt;/pre&amp;gt;
&amp;lt;/blockquote&amp;gt;
&amp;lt;pre wrap=""&amp;gt;&amp;lt;!----&amp;gt;containment
&amp;lt;/pre&amp;gt;
&amp;lt;blockquote type="cite"


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:update operation has failed
Next Topic:[Teneo] Integrating Teneo-Struts-Tomcat
Goto Forum:
  


Current Time: Thu Mar 28 09:59:05 GMT 2024

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

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

Back to the top