Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Teneo: HibernateResource is not smart enough
Teneo: HibernateResource is not smart enough [message #62119] Mon, 20 November 2006 11:35 Go to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Hi

I suppose question is for Martin Taal.

My problem is that HibernateResource is not enough for me.

I can specify hsql query for resource only before loading it.
I need to load some objects into my resource during startup and then load
some other objects incrementally using Criteria or HSQL - criteria is
preferred.
Could it be as some new method like List
HibernateResource.fetchAndLoad(Criteria c) that will fetch objects from
DB, add them to resource if they are not in resource already. I need
correct adding to resource - corresponding listeners
must receive notifications about adding objects to resource.

also i nave seen that StoreResource.attached(Eobject) which is called when
for example lazy collection is fetched doesn't add loaded objects to
resource - so resource.getContents() are not equal union of loadedObjects,
modifiedObjects, newObjects - it's very inconvenient for EMF client
application.

BTW I read comments in StoreResource.load():
// fill in the resource, do not use the normal add method because it
// is possible that a child of a container is loaded, in that case
// the normal add will remove the container of the object when the
// resource is set in the child object, this issue can happen with
/ direct reads using queries.
StoreUtil.setEResource((InternalEObject) obj, this, true);
elist.basicAdd(obj, null);
attached((EObject) obj);

BUT: In my application objects are not distributed across resources - all
objects are in one resource and supposed to be added incrementally.

Also there are no containment relationships in my model.

I can implement classes for my need on my own but I suppose that my
problem is quite general problem (now or in future) - so I need some
response from you.

Thanks in advance.
Re: Teneo: HibernateResource is not smart enough [message #62142 is a reply to message #62119] Mon, 20 November 2006 12:32 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
When does the attached method not add loaded objects (to loadedObjects)?

Yes, I can agree that incremental load is a nice feature, although you are the first to ask about it
(afair). I think the implementation is not that hard. The main thing is to call setIsLoading(true)
when incrementally loading extra objects (and setIsLoading(false) afterwards).
Contributions in this area are ofcourse welcome.

gr. Martin

Ilya Klyuchnikov wrote:
> Hi
>
> I suppose question is for Martin Taal.
>
> My problem is that HibernateResource is not enough for me.
>
> I can specify hsql query for resource only before loading it.
> I need to load some objects into my resource during startup and then
> load some other objects incrementally using Criteria or HSQL - criteria
> is preferred.
> Could it be as some new method like List
> HibernateResource.fetchAndLoad(Criteria c) that will fetch objects from
> DB, add them to resource if they are not in resource already. I need
> correct adding to resource - corresponding listeners must receive
> notifications about adding objects to resource.
>
> also i nave seen that StoreResource.attached(Eobject) which is called
> when for example lazy collection is fetched doesn't add loaded objects
> to resource - so resource.getContents() are not equal union of
> loadedObjects, modifiedObjects, newObjects - it's very inconvenient for
> EMF client application.
>
> BTW I read comments in StoreResource.load():
> // fill in the resource, do not use the normal add method because it
> // is possible that a child of a container is loaded, in that case
> // the normal add will remove the container of the object when the
> // resource is set in the child object, this issue can happen with
> / direct reads using queries.
> StoreUtil.setEResource((InternalEObject) obj, this, true);
> elist.basicAdd(obj, null);
> attached((EObject) obj);
>
> BUT: In my application objects are not distributed across resources -
> all objects are in one resource and supposed to be added incrementally.
>
> Also there are no containment relationships in my model.
>
> I can implement classes for my need on my own but I suppose that my
> problem is quite general problem (now or in future) - so I need some
> response from you.
>
> Thanks in advance.
>


--

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: HibernateResource is not smart enough [message #62166 is a reply to message #62142] Mon, 20 November 2006 13:14 Go to previous messageGo to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
I am sorry - attached method DOES add loaded objects (to loadedObjects).

Also it adds them to Resource via StoreUtil.setEResource((InternalEObject)
obj, this, true);

BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
Re: Teneo: HibernateResource is not smart enough [message #62190 is a reply to message #62166] Mon, 20 November 2006 13:52 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Did you call setTrackingModification(true)?

gr. Martin

Ilya Klyuchnikov wrote:
> I am sorry - attached method DOES add loaded objects (to loadedObjects).
>
> Also it adds them to Resource via
> StoreUtil.setEResource((InternalEObject) obj, this, true);
>
> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
>


--

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: HibernateResource is not smart enough [message #62215 is a reply to message #62190] Mon, 20 November 2006 14:45 Go to previous messageGo to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Martin Taal wrote:

> Did you call setTrackingModification(true)?

> gr. Martin

> Ilya Klyuchnikov wrote:
>> I am sorry - attached method DOES add loaded objects (to loadedObjects).
>>
>> Also it adds them to Resource via
>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>
>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
>>


I mean another thing:

In StoreUtil:
public static void setEResource(InternalEObject eobj, Resource.Internal
resource, boolean force) {
if (eobj.eResource() != null && eobj.eResource() != resource && !force)
return;

InternalEObject currentEObject = eobj;
while (currentEObject.eContainer() != null &&
!currentEObject.eContainmentFeature().isResolveProxies()) {
currentEObject = (InternalEObject) currentEObject.eContainer();
AssertUtil.assertNotSameObject(currentEObject,
currentEObject.eContainer());
}
currentEObject.eSetResource(resource, null);
}

currentEObject.eSetResource returns NotificationChain
but notifications are not dispatched.

For example:
I have loaded some objects with lazy collections into HibernateResource.
When I touch objects from lazy collection these objects are loaded into my
resource but because notifications are not dispatched my
adapters/listeners are not informed about loading of new objects from db.
Re: Teneo: HibernateResource is not smart enough [message #62238 is a reply to message #62215] Mon, 20 November 2006 14:58 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Okay I understand (is a bug/missing feature). There is also an option
XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when this is solved.
Can you enter a bugzilla for this?
Would you be able to send in a patch (would speed up the solution considerably)?

gr. Martin

Ilya Klyuchnikov wrote:
> Martin Taal wrote:
>
>> Did you call setTrackingModification(true)?
>
>> gr. Martin
>
>> Ilya Klyuchnikov wrote:
>>> I am sorry - attached method DOES add loaded objects (to loadedObjects).
>>>
>>> Also it adds them to Resource via
>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>
>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
>>>
>
>
> I mean another thing:
>
> In StoreUtil:
> public static void setEResource(InternalEObject eobj, Resource.Internal
> resource, boolean force) {
> if (eobj.eResource() != null && eobj.eResource() != resource &&
> !force)
> return;
>
> InternalEObject currentEObject = eobj;
> while (currentEObject.eContainer() != null &&
> !currentEObject.eContainmentFeature().isResolveProxies()) {
> currentEObject = (InternalEObject) currentEObject.eContainer();
> AssertUtil.assertNotSameObject(currentEObject,
> currentEObject.eContainer());
> }
> currentEObject.eSetResource(resource, null);
> }
>
> currentEObject.eSetResource returns NotificationChain
> but notifications are not dispatched.
>
> For example:
> I have loaded some objects with lazy collections into HibernateResource.
> When I touch objects from lazy collection these objects are loaded into
> my resource but because notifications are not dispatched my
> adapters/listeners are not informed about loading of new objects from db.
>


--

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: HibernateResource is not smart enough [message #62261 is a reply to message #62238] Mon, 20 November 2006 15:18 Go to previous messageGo to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
I will create issue and patch ASAP.

But I need your advice:

XMLResource.OPTION_DISABLE_NOTIFY controls notifications during EMF
standard loading only (common EMF resources are associated with files - so
there is no incremental "lazy" loading from the same resource).

I think that to solve my problem and to make Teneo flexible another option
is needed - something like
StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY.

Do you agree?

Thanks.

Martin Taal wrote:

> Okay I understand (is a bug/missing feature). There is also an option
> XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when
this is solved.
> Can you enter a bugzilla for this?
> Would you be able to send in a patch (would speed up the solution
considerably)?

> gr. Martin

> Ilya Klyuchnikov wrote:
>> Martin Taal wrote:
>>
>>> Did you call setTrackingModification(true)?
>>
>>> gr. Martin
>>
>>> Ilya Klyuchnikov wrote:
>>>> I am sorry - attached method DOES add loaded objects (to loadedObjects).
>>>>
>>>> Also it adds them to Resource via
>>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>>
>>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
>>>>
>>
>>
>> I mean another thing:
>>
>> In StoreUtil:
>> public static void setEResource(InternalEObject eobj, Resource.Internal
>> resource, boolean force) {
>> if (eobj.eResource() != null && eobj.eResource() != resource &&
>> !force)
>> return;
>>
>> InternalEObject currentEObject = eobj;
>> while (currentEObject.eContainer() != null &&
>> !currentEObject.eContainmentFeature().isResolveProxies()) {
>> currentEObject = (InternalEObject) currentEObject.eContainer();
>> AssertUtil.assertNotSameObject(currentEObject,
>> currentEObject.eContainer());
>> }
>> currentEObject.eSetResource(resource, null);
>> }
>>
>> currentEObject.eSetResource returns NotificationChain
>> but notifications are not dispatched.
>>
>> For example:
>> I have loaded some objects with lazy collections into HibernateResource.
>> When I touch objects from lazy collection these objects are loaded into
>> my resource but because notifications are not dispatched my
>> adapters/listeners are not informed about loading of new objects from db.
>>
Re: Teneo: HibernateResource is not smart enough [message #62285 is a reply to message #62261] Mon, 20 November 2006 15:38 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
What you mean is that you want to disable notify during initial load and enable (or disable) it
during later loads?

So:
XMLResource.OPTION_DISABLE_NOTIFY=true means that during initial load no notifications are send
StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY=true means that during later lazy loads no
notifications are send.

To support this the Storeresource needs to know that additional load actions are being performed and
they are caused by lazy-load events.

Thinking further:
You mentioned earlier that you also wanted to support incremental loads (not only through lazy
loads). Would this option also control notifications during additional loads?
Maybe a distinction should be made between automatic loads (like a lazy load) and explicit
additional loads? (thinking out loud here)
But to introduce different options for all these cases is maybe too much.
So what I think:
XMLResource.OPTION_DISABLE_NOTIFY controls notifications for explicit load actions (initial, or
otherwise)
StoreResource.OPTION_DISABLE_ADDITIONAL_LOADING_NOTIFY controls notification only for lazy loading
of elists (automatic loading behind the scenes).

What do you think?

Some tips: the lazy load of elists is done in two classes (both in doLoad method):
org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList
org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableFeatureMap

Instead of setLoading(true), something like setLazyLoading (or something) should be done (to make
use of the lazy load option above).

gr. Martin

Ilya Klyuchnikov wrote:
> I will create issue and patch ASAP.
>
> But I need your advice:
>
> XMLResource.OPTION_DISABLE_NOTIFY controls notifications during EMF
> standard loading only (common EMF resources are associated with files -
> so there is no incremental "lazy" loading from the same resource).
>
> I think that to solve my problem and to make Teneo flexible another
> option is needed - something like
> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY.
>
> Do you agree?
>
> Thanks.
>
> Martin Taal wrote:
>
>> Okay I understand (is a bug/missing feature). There is also an option
>> XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when
> this is solved.
>> Can you enter a bugzilla for this?
>> Would you be able to send in a patch (would speed up the solution
> considerably)?
>
>> gr. Martin
>
>> Ilya Klyuchnikov wrote:
>>> Martin Taal wrote:
>>>
>>>> Did you call setTrackingModification(true)?
>>>
>>>> gr. Martin
>>>
>>>> Ilya Klyuchnikov wrote:
>>>>> I am sorry - attached method DOES add loaded objects (to
>>>>> loadedObjects).
>>>>>
>>>>> Also it adds them to Resource via
>>>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>>>
>>>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE
>>>>> RESOURCE.
>>>>>
>>>
>>>
>>> I mean another thing:
>>>
>>> In StoreUtil:
>>> public static void setEResource(InternalEObject eobj,
>>> Resource.Internal resource, boolean force) {
>>> if (eobj.eResource() != null && eobj.eResource() != resource
>>> && !force)
>>> return;
>>>
>>> InternalEObject currentEObject = eobj;
>>> while (currentEObject.eContainer() != null &&
>>> !currentEObject.eContainmentFeature().isResolveProxies()) {
>>> currentEObject = (InternalEObject)
>>> currentEObject.eContainer();
>>> AssertUtil.assertNotSameObject(currentEObject,
>>> currentEObject.eContainer());
>>> }
>>> currentEObject.eSetResource(resource, null);
>>> }
>>>
>>> currentEObject.eSetResource returns NotificationChain
>>> but notifications are not dispatched.
>>>
>>> For example:
>>> I have loaded some objects with lazy collections into
>>> HibernateResource. When I touch objects from lazy collection these
>>> objects are loaded into my resource but because notifications are not
>>> dispatched my adapters/listeners are not informed about loading of
>>> new objects from db.
>>>
>
>
>
>


--

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: HibernateResource is not smart enough [message #62333 is a reply to message #62285] Mon, 20 November 2006 16:41 Go to previous messageGo to next message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
I agree - two options XMLResource.OPTION_DISABLE_NOTIFY and
StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY are enough.

Simplicity and transparency is major.

Thanks.

Martin Taal wrote:

> What you mean is that you want to disable notify during initial load and
enable (or disable) it
> during later loads?

> So:
> XMLResource.OPTION_DISABLE_NOTIFY=true means that during initial load no
notifications are send
> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY=true means that during
later lazy loads no
> notifications are send.

> To support this the Storeresource needs to know that additional load actions
are being performed and
> they are caused by lazy-load events.

> Thinking further:
> You mentioned earlier that you also wanted to support incremental loads (not
only through lazy
> loads). Would this option also control notifications during additional loads?
> Maybe a distinction should be made between automatic loads (like a lazy
load) and explicit
> additional loads? (thinking out loud here)
> But to introduce different options for all these cases is maybe too much.
> So what I think:
> XMLResource.OPTION_DISABLE_NOTIFY controls notifications for explicit load
actions (initial, or
> otherwise)
> StoreResource.OPTION_DISABLE_ADDITIONAL_LOADING_NOTIFY controls notification
only for lazy loading
> of elists (automatic loading behind the scenes).

> What do you think?

> Some tips: the lazy load of elists is done in two classes (both in doLoad
method):
> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList
> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableFeatureMap

> Instead of setLoading(true), something like setLazyLoading (or something)
should be done (to make
> use of the lazy load option above).

> gr. Martin

> Ilya Klyuchnikov wrote:
>> I will create issue and patch ASAP.
>>
>> But I need your advice:
>>
>> XMLResource.OPTION_DISABLE_NOTIFY controls notifications during EMF
>> standard loading only (common EMF resources are associated with files -
>> so there is no incremental "lazy" loading from the same resource).
>>
>> I think that to solve my problem and to make Teneo flexible another
>> option is needed - something like
>> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY.
>>
>> Do you agree?
>>
>> Thanks.
>>
>> Martin Taal wrote:
>>
>>> Okay I understand (is a bug/missing feature). There is also an option
>>> XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when
>> this is solved.
>>> Can you enter a bugzilla for this?
>>> Would you be able to send in a patch (would speed up the solution
>> considerably)?
>>
>>> gr. Martin
>>
>>> Ilya Klyuchnikov wrote:
>>>> Martin Taal wrote:
>>>>
>>>>> Did you call setTrackingModification(true)?
>>>>
>>>>> gr. Martin
>>>>
>>>>> Ilya Klyuchnikov wrote:
>>>>>> I am sorry - attached method DOES add loaded objects (to
>>>>>> loadedObjects).
>>>>>>
>>>>>> Also it adds them to Resource via
>>>>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>>>>
>>>>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE
>>>>>> RESOURCE.
>>>>>>
>>>>
>>>>
>>>> I mean another thing:
>>>>
>>>> In StoreUtil:
>>>> public static void setEResource(InternalEObject eobj,
>>>> Resource.Internal resource, boolean force) {
>>>> if (eobj.eResource() != null && eobj.eResource() != resource
>>>> && !force)
>>>> return;
>>>>
>>>> InternalEObject currentEObject = eobj;
>>>> while (currentEObject.eContainer() != null &&
>>>> !currentEObject.eContainmentFeature().isResolveProxies()) {
>>>> currentEObject = (InternalEObject)
>>>> currentEObject.eContainer();
>>>> AssertUtil.assertNotSameObject(currentEObject,
>>>> currentEObject.eContainer());
>>>> }
>>>> currentEObject.eSetResource(resource, null);
>>>> }
>>>>
>>>> currentEObject.eSetResource returns NotificationChain
>>>> but notifications are not dispatched.
>>>>
>>>> For example:
>>>> I have loaded some objects with lazy collections into
>>>> HibernateResource. When I touch objects from lazy collection these
>>>> objects are loaded into my resource but because notifications are not
>>>> dispatched my adapters/listeners are not informed about loading of
>>>> new objects from db.
>>>>
>>
>>
>>
>>
Re: Teneo: HibernateResource is not smart enough [message #62499 is a reply to message #62333] Wed, 22 November 2006 10:08 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Ilya Klyuchnikov wrote:

I have create issue 165428 about notification and supplied patch.
I will create issue about additional loading by query today.
I hope that I can create patch for additional loading till Friday.

Thanks

> I agree - two options XMLResource.OPTION_DISABLE_NOTIFY and
> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY are enough.
>
> Simplicity and transparency is major.
>
> Thanks.
>
> Martin Taal wrote:

>> What you mean is that you want to disable notify during initial load and
> enable (or disable) it
>> during later loads?
>>
>> So:
>> XMLResource.OPTION_DISABLE_NOTIFY=true means that during initial load no
>> notifications are send
>> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY=true means that during
>> later lazy loads no
>> notifications are send.
>>
>> To support this the Storeresource needs to know that additional load
actions
>> are being performed and
>> they are caused by lazy-load events.
>>
>> Thinking further:
>> You mentioned earlier that you also wanted to support incremental loads
(not
>> only through lazy
>> loads). Would this option also control notifications during additional
loads?
>> Maybe a distinction should be made between automatic loads (like a lazy
>> load) and explicit
>> additional loads? (thinking out loud here)
>> But to introduce different options for all these cases is maybe too much.
>> So what I think:
>> XMLResource.OPTION_DISABLE_NOTIFY controls notifications for explicit load
>> actions (initial, or
>> otherwise)
>> StoreResource.OPTION_DISABLE_ADDITIONAL_LOADING_NOTIFY controls
notification
>> only for lazy loading
>> of elists (automatic loading behind the scenes).
>>
>> What do you think?
>>
>> Some tips: the lazy load of elists is done in two classes (both in doLoad
>> method):
>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList
>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableFeatureMap
>>
>> Instead of setLoading(true), something like setLazyLoading (or something)
>> should be done (to make
>> use of the lazy load option above).
>>
>> gr. Martin
>>
>> Ilya Klyuchnikov wrote:
>>> I will create issue and patch ASAP.
>>>
>>> But I need your advice:
>>>
>>> XMLResource.OPTION_DISABLE_NOTIFY controls notifications during EMF
>>> standard loading only (common EMF resources are associated with files -
>>> so there is no incremental "lazy" loading from the same resource).
>>>
>>> I think that to solve my problem and to make Teneo flexible another
>>> option is needed - something like
>>> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY.
>>>
>>> Do you agree?
>>>
>>> Thanks.
>>>
>>> Martin Taal wrote:
>>>
>>>> Okay I understand (is a bug/missing feature). There is also an option
>>>> XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when
>>> this is solved.
>>>> Can you enter a bugzilla for this?
>>>> Would you be able to send in a patch (would speed up the solution
>>> considerably)?
>>>
>>>> gr. Martin
>>>
>>>> Ilya Klyuchnikov wrote:
>>>>> Martin Taal wrote:
>>>>>
>>>>>> Did you call setTrackingModification(true)?
>>>>>
>>>>>> gr. Martin
>>>>>
>>>>>> Ilya Klyuchnikov wrote:
>>>>>>> I am sorry - attached method DOES add loaded objects (to
>>>>>>> loadedObjects).
>>>>>>>
>>>>>>> Also it adds them to Resource via
>>>>>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>>>>>
>>>>>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE
>>>>>>> RESOURCE.
>>>>>>>
>>>>>
>>>>>
>>>>> I mean another thing:
>>>>>
>>>>> In StoreUtil:
>>>>> public static void setEResource(InternalEObject eobj,
>>>>> Resource.Internal resource, boolean force) {
>>>>> if (eobj.eResource() != null && eobj.eResource() != resource
>>>>> && !force)
>>>>> return;
>>>>>
>>>>> InternalEObject currentEObject = eobj;
>>>>> while (currentEObject.eContainer() != null &&
>>>>> !currentEObject.eContainmentFeature().isResolveProxies()) {
>>>>> currentEObject = (InternalEObject)
>>>>> currentEObject.eContainer();
>>>>> AssertUtil.assertNotSameObject(currentEObject,
>>>>> currentEObject.eContainer());
>>>>> }
>>>>> currentEObject.eSetResource(resource, null);
>>>>> }
>>>>>
>>>>> currentEObject.eSetResource returns NotificationChain
>>>>> but notifications are not dispatched.
>>>>>
>>>>> For example:
>>>>> I have loaded some objects with lazy collections into
>>>>> HibernateResource. When I touch objects from lazy collection these
>>>>> objects are loaded into my resource but because notifications are not
>>>>> dispatched my adapters/listeners are not informed about loading of
>>>>> new objects from db.
>>>>>
>>>
>>>
>>>
>>>
Re: Teneo: HibernateResource is not smart enough [message #595919 is a reply to message #62119] Mon, 20 November 2006 12:32 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
When does the attached method not add loaded objects (to loadedObjects)?

Yes, I can agree that incremental load is a nice feature, although you are the first to ask about it
(afair). I think the implementation is not that hard. The main thing is to call setIsLoading(true)
when incrementally loading extra objects (and setIsLoading(false) afterwards).
Contributions in this area are ofcourse welcome.

gr. Martin

Ilya Klyuchnikov wrote:
> Hi
>
> I suppose question is for Martin Taal.
>
> My problem is that HibernateResource is not enough for me.
>
> I can specify hsql query for resource only before loading it.
> I need to load some objects into my resource during startup and then
> load some other objects incrementally using Criteria or HSQL - criteria
> is preferred.
> Could it be as some new method like List
> HibernateResource.fetchAndLoad(Criteria c) that will fetch objects from
> DB, add them to resource if they are not in resource already. I need
> correct adding to resource - corresponding listeners must receive
> notifications about adding objects to resource.
>
> also i nave seen that StoreResource.attached(Eobject) which is called
> when for example lazy collection is fetched doesn't add loaded objects
> to resource - so resource.getContents() are not equal union of
> loadedObjects, modifiedObjects, newObjects - it's very inconvenient for
> EMF client application.
>
> BTW I read comments in StoreResource.load():
> // fill in the resource, do not use the normal add method because it
> // is possible that a child of a container is loaded, in that case
> // the normal add will remove the container of the object when the
> // resource is set in the child object, this issue can happen with
> / direct reads using queries.
> StoreUtil.setEResource((InternalEObject) obj, this, true);
> elist.basicAdd(obj, null);
> attached((EObject) obj);
>
> BUT: In my application objects are not distributed across resources -
> all objects are in one resource and supposed to be added incrementally.
>
> Also there are no containment relationships in my model.
>
> I can implement classes for my need on my own but I suppose that my
> problem is quite general problem (now or in future) - so I need some
> response from you.
>
> Thanks in advance.
>


--

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: HibernateResource is not smart enough [message #595929 is a reply to message #62142] Mon, 20 November 2006 13:14 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
I am sorry - attached method DOES add loaded objects (to loadedObjects).

Also it adds them to Resource via StoreUtil.setEResource((InternalEObject)
obj, this, true);

BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
Re: Teneo: HibernateResource is not smart enough [message #595937 is a reply to message #62166] Mon, 20 November 2006 13:52 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Did you call setTrackingModification(true)?

gr. Martin

Ilya Klyuchnikov wrote:
> I am sorry - attached method DOES add loaded objects (to loadedObjects).
>
> Also it adds them to Resource via
> StoreUtil.setEResource((InternalEObject) obj, this, true);
>
> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
>


--

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: HibernateResource is not smart enough [message #595943 is a reply to message #62190] Mon, 20 November 2006 14:45 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Martin Taal wrote:

> Did you call setTrackingModification(true)?

> gr. Martin

> Ilya Klyuchnikov wrote:
>> I am sorry - attached method DOES add loaded objects (to loadedObjects).
>>
>> Also it adds them to Resource via
>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>
>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
>>


I mean another thing:

In StoreUtil:
public static void setEResource(InternalEObject eobj, Resource.Internal
resource, boolean force) {
if (eobj.eResource() != null && eobj.eResource() != resource && !force)
return;

InternalEObject currentEObject = eobj;
while (currentEObject.eContainer() != null &&
!currentEObject.eContainmentFeature().isResolveProxies()) {
currentEObject = (InternalEObject) currentEObject.eContainer();
AssertUtil.assertNotSameObject(currentEObject,
currentEObject.eContainer());
}
currentEObject.eSetResource(resource, null);
}

currentEObject.eSetResource returns NotificationChain
but notifications are not dispatched.

For example:
I have loaded some objects with lazy collections into HibernateResource.
When I touch objects from lazy collection these objects are loaded into my
resource but because notifications are not dispatched my
adapters/listeners are not informed about loading of new objects from db.
Re: Teneo: HibernateResource is not smart enough [message #595951 is a reply to message #62215] Mon, 20 November 2006 14:58 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Okay I understand (is a bug/missing feature). There is also an option
XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when this is solved.
Can you enter a bugzilla for this?
Would you be able to send in a patch (would speed up the solution considerably)?

gr. Martin

Ilya Klyuchnikov wrote:
> Martin Taal wrote:
>
>> Did you call setTrackingModification(true)?
>
>> gr. Martin
>
>> Ilya Klyuchnikov wrote:
>>> I am sorry - attached method DOES add loaded objects (to loadedObjects).
>>>
>>> Also it adds them to Resource via
>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>
>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
>>>
>
>
> I mean another thing:
>
> In StoreUtil:
> public static void setEResource(InternalEObject eobj, Resource.Internal
> resource, boolean force) {
> if (eobj.eResource() != null && eobj.eResource() != resource &&
> !force)
> return;
>
> InternalEObject currentEObject = eobj;
> while (currentEObject.eContainer() != null &&
> !currentEObject.eContainmentFeature().isResolveProxies()) {
> currentEObject = (InternalEObject) currentEObject.eContainer();
> AssertUtil.assertNotSameObject(currentEObject,
> currentEObject.eContainer());
> }
> currentEObject.eSetResource(resource, null);
> }
>
> currentEObject.eSetResource returns NotificationChain
> but notifications are not dispatched.
>
> For example:
> I have loaded some objects with lazy collections into HibernateResource.
> When I touch objects from lazy collection these objects are loaded into
> my resource but because notifications are not dispatched my
> adapters/listeners are not informed about loading of new objects from db.
>


--

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: HibernateResource is not smart enough [message #595958 is a reply to message #62238] Mon, 20 November 2006 15:18 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
I will create issue and patch ASAP.

But I need your advice:

XMLResource.OPTION_DISABLE_NOTIFY controls notifications during EMF
standard loading only (common EMF resources are associated with files - so
there is no incremental "lazy" loading from the same resource).

I think that to solve my problem and to make Teneo flexible another option
is needed - something like
StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY.

Do you agree?

Thanks.

Martin Taal wrote:

> Okay I understand (is a bug/missing feature). There is also an option
> XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when
this is solved.
> Can you enter a bugzilla for this?
> Would you be able to send in a patch (would speed up the solution
considerably)?

> gr. Martin

> Ilya Klyuchnikov wrote:
>> Martin Taal wrote:
>>
>>> Did you call setTrackingModification(true)?
>>
>>> gr. Martin
>>
>>> Ilya Klyuchnikov wrote:
>>>> I am sorry - attached method DOES add loaded objects (to loadedObjects).
>>>>
>>>> Also it adds them to Resource via
>>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>>
>>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE RESOURCE.
>>>>
>>
>>
>> I mean another thing:
>>
>> In StoreUtil:
>> public static void setEResource(InternalEObject eobj, Resource.Internal
>> resource, boolean force) {
>> if (eobj.eResource() != null && eobj.eResource() != resource &&
>> !force)
>> return;
>>
>> InternalEObject currentEObject = eobj;
>> while (currentEObject.eContainer() != null &&
>> !currentEObject.eContainmentFeature().isResolveProxies()) {
>> currentEObject = (InternalEObject) currentEObject.eContainer();
>> AssertUtil.assertNotSameObject(currentEObject,
>> currentEObject.eContainer());
>> }
>> currentEObject.eSetResource(resource, null);
>> }
>>
>> currentEObject.eSetResource returns NotificationChain
>> but notifications are not dispatched.
>>
>> For example:
>> I have loaded some objects with lazy collections into HibernateResource.
>> When I touch objects from lazy collection these objects are loaded into
>> my resource but because notifications are not dispatched my
>> adapters/listeners are not informed about loading of new objects from db.
>>
Re: Teneo: HibernateResource is not smart enough [message #595961 is a reply to message #62261] Mon, 20 November 2006 15:38 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
What you mean is that you want to disable notify during initial load and enable (or disable) it
during later loads?

So:
XMLResource.OPTION_DISABLE_NOTIFY=true means that during initial load no notifications are send
StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY=true means that during later lazy loads no
notifications are send.

To support this the Storeresource needs to know that additional load actions are being performed and
they are caused by lazy-load events.

Thinking further:
You mentioned earlier that you also wanted to support incremental loads (not only through lazy
loads). Would this option also control notifications during additional loads?
Maybe a distinction should be made between automatic loads (like a lazy load) and explicit
additional loads? (thinking out loud here)
But to introduce different options for all these cases is maybe too much.
So what I think:
XMLResource.OPTION_DISABLE_NOTIFY controls notifications for explicit load actions (initial, or
otherwise)
StoreResource.OPTION_DISABLE_ADDITIONAL_LOADING_NOTIFY controls notification only for lazy loading
of elists (automatic loading behind the scenes).

What do you think?

Some tips: the lazy load of elists is done in two classes (both in doLoad method):
org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList
org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableFeatureMap

Instead of setLoading(true), something like setLazyLoading (or something) should be done (to make
use of the lazy load option above).

gr. Martin

Ilya Klyuchnikov wrote:
> I will create issue and patch ASAP.
>
> But I need your advice:
>
> XMLResource.OPTION_DISABLE_NOTIFY controls notifications during EMF
> standard loading only (common EMF resources are associated with files -
> so there is no incremental "lazy" loading from the same resource).
>
> I think that to solve my problem and to make Teneo flexible another
> option is needed - something like
> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY.
>
> Do you agree?
>
> Thanks.
>
> Martin Taal wrote:
>
>> Okay I understand (is a bug/missing feature). There is also an option
>> XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when
> this is solved.
>> Can you enter a bugzilla for this?
>> Would you be able to send in a patch (would speed up the solution
> considerably)?
>
>> gr. Martin
>
>> Ilya Klyuchnikov wrote:
>>> Martin Taal wrote:
>>>
>>>> Did you call setTrackingModification(true)?
>>>
>>>> gr. Martin
>>>
>>>> Ilya Klyuchnikov wrote:
>>>>> I am sorry - attached method DOES add loaded objects (to
>>>>> loadedObjects).
>>>>>
>>>>> Also it adds them to Resource via
>>>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>>>
>>>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE
>>>>> RESOURCE.
>>>>>
>>>
>>>
>>> I mean another thing:
>>>
>>> In StoreUtil:
>>> public static void setEResource(InternalEObject eobj,
>>> Resource.Internal resource, boolean force) {
>>> if (eobj.eResource() != null && eobj.eResource() != resource
>>> && !force)
>>> return;
>>>
>>> InternalEObject currentEObject = eobj;
>>> while (currentEObject.eContainer() != null &&
>>> !currentEObject.eContainmentFeature().isResolveProxies()) {
>>> currentEObject = (InternalEObject)
>>> currentEObject.eContainer();
>>> AssertUtil.assertNotSameObject(currentEObject,
>>> currentEObject.eContainer());
>>> }
>>> currentEObject.eSetResource(resource, null);
>>> }
>>>
>>> currentEObject.eSetResource returns NotificationChain
>>> but notifications are not dispatched.
>>>
>>> For example:
>>> I have loaded some objects with lazy collections into
>>> HibernateResource. When I touch objects from lazy collection these
>>> objects are loaded into my resource but because notifications are not
>>> dispatched my adapters/listeners are not informed about loading of
>>> new objects from db.
>>>
>
>
>
>


--

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: HibernateResource is not smart enough [message #595979 is a reply to message #62285] Mon, 20 November 2006 16:41 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
I agree - two options XMLResource.OPTION_DISABLE_NOTIFY and
StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY are enough.

Simplicity and transparency is major.

Thanks.

Martin Taal wrote:

> What you mean is that you want to disable notify during initial load and
enable (or disable) it
> during later loads?

> So:
> XMLResource.OPTION_DISABLE_NOTIFY=true means that during initial load no
notifications are send
> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY=true means that during
later lazy loads no
> notifications are send.

> To support this the Storeresource needs to know that additional load actions
are being performed and
> they are caused by lazy-load events.

> Thinking further:
> You mentioned earlier that you also wanted to support incremental loads (not
only through lazy
> loads). Would this option also control notifications during additional loads?
> Maybe a distinction should be made between automatic loads (like a lazy
load) and explicit
> additional loads? (thinking out loud here)
> But to introduce different options for all these cases is maybe too much.
> So what I think:
> XMLResource.OPTION_DISABLE_NOTIFY controls notifications for explicit load
actions (initial, or
> otherwise)
> StoreResource.OPTION_DISABLE_ADDITIONAL_LOADING_NOTIFY controls notification
only for lazy loading
> of elists (automatic loading behind the scenes).

> What do you think?

> Some tips: the lazy load of elists is done in two classes (both in doLoad
method):
> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList
> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableFeatureMap

> Instead of setLoading(true), something like setLazyLoading (or something)
should be done (to make
> use of the lazy load option above).

> gr. Martin

> Ilya Klyuchnikov wrote:
>> I will create issue and patch ASAP.
>>
>> But I need your advice:
>>
>> XMLResource.OPTION_DISABLE_NOTIFY controls notifications during EMF
>> standard loading only (common EMF resources are associated with files -
>> so there is no incremental "lazy" loading from the same resource).
>>
>> I think that to solve my problem and to make Teneo flexible another
>> option is needed - something like
>> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY.
>>
>> Do you agree?
>>
>> Thanks.
>>
>> Martin Taal wrote:
>>
>>> Okay I understand (is a bug/missing feature). There is also an option
>>> XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when
>> this is solved.
>>> Can you enter a bugzilla for this?
>>> Would you be able to send in a patch (would speed up the solution
>> considerably)?
>>
>>> gr. Martin
>>
>>> Ilya Klyuchnikov wrote:
>>>> Martin Taal wrote:
>>>>
>>>>> Did you call setTrackingModification(true)?
>>>>
>>>>> gr. Martin
>>>>
>>>>> Ilya Klyuchnikov wrote:
>>>>>> I am sorry - attached method DOES add loaded objects (to
>>>>>> loadedObjects).
>>>>>>
>>>>>> Also it adds them to Resource via
>>>>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>>>>
>>>>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE
>>>>>> RESOURCE.
>>>>>>
>>>>
>>>>
>>>> I mean another thing:
>>>>
>>>> In StoreUtil:
>>>> public static void setEResource(InternalEObject eobj,
>>>> Resource.Internal resource, boolean force) {
>>>> if (eobj.eResource() != null && eobj.eResource() != resource
>>>> && !force)
>>>> return;
>>>>
>>>> InternalEObject currentEObject = eobj;
>>>> while (currentEObject.eContainer() != null &&
>>>> !currentEObject.eContainmentFeature().isResolveProxies()) {
>>>> currentEObject = (InternalEObject)
>>>> currentEObject.eContainer();
>>>> AssertUtil.assertNotSameObject(currentEObject,
>>>> currentEObject.eContainer());
>>>> }
>>>> currentEObject.eSetResource(resource, null);
>>>> }
>>>>
>>>> currentEObject.eSetResource returns NotificationChain
>>>> but notifications are not dispatched.
>>>>
>>>> For example:
>>>> I have loaded some objects with lazy collections into
>>>> HibernateResource. When I touch objects from lazy collection these
>>>> objects are loaded into my resource but because notifications are not
>>>> dispatched my adapters/listeners are not informed about loading of
>>>> new objects from db.
>>>>
>>
>>
>>
>>
Re: Teneo: HibernateResource is not smart enough [message #596048 is a reply to message #62333] Wed, 22 November 2006 10:08 Go to previous message
Ilya Klyuchnikov is currently offline Ilya KlyuchnikovFriend
Messages: 74
Registered: July 2009
Member
Ilya Klyuchnikov wrote:

I have create issue 165428 about notification and supplied patch.
I will create issue about additional loading by query today.
I hope that I can create patch for additional loading till Friday.

Thanks

> I agree - two options XMLResource.OPTION_DISABLE_NOTIFY and
> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY are enough.
>
> Simplicity and transparency is major.
>
> Thanks.
>
> Martin Taal wrote:

>> What you mean is that you want to disable notify during initial load and
> enable (or disable) it
>> during later loads?
>>
>> So:
>> XMLResource.OPTION_DISABLE_NOTIFY=true means that during initial load no
>> notifications are send
>> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY=true means that during
>> later lazy loads no
>> notifications are send.
>>
>> To support this the Storeresource needs to know that additional load
actions
>> are being performed and
>> they are caused by lazy-load events.
>>
>> Thinking further:
>> You mentioned earlier that you also wanted to support incremental loads
(not
>> only through lazy
>> loads). Would this option also control notifications during additional
loads?
>> Maybe a distinction should be made between automatic loads (like a lazy
>> load) and explicit
>> additional loads? (thinking out loud here)
>> But to introduce different options for all these cases is maybe too much.
>> So what I think:
>> XMLResource.OPTION_DISABLE_NOTIFY controls notifications for explicit load
>> actions (initial, or
>> otherwise)
>> StoreResource.OPTION_DISABLE_ADDITIONAL_LOADING_NOTIFY controls
notification
>> only for lazy loading
>> of elists (automatic loading behind the scenes).
>>
>> What do you think?
>>
>> Some tips: the lazy load of elists is done in two classes (both in doLoad
>> method):
>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList
>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableFeatureMap
>>
>> Instead of setLoading(true), something like setLazyLoading (or something)
>> should be done (to make
>> use of the lazy load option above).
>>
>> gr. Martin
>>
>> Ilya Klyuchnikov wrote:
>>> I will create issue and patch ASAP.
>>>
>>> But I need your advice:
>>>
>>> XMLResource.OPTION_DISABLE_NOTIFY controls notifications during EMF
>>> standard loading only (common EMF resources are associated with files -
>>> so there is no incremental "lazy" loading from the same resource).
>>>
>>> I think that to solve my problem and to make Teneo flexible another
>>> option is needed - something like
>>> StoreResource.OPTION_DISABLE_LAZY_LOADING_NOTIFY.
>>>
>>> Do you agree?
>>>
>>> Thanks.
>>>
>>> Martin Taal wrote:
>>>
>>>> Okay I understand (is a bug/missing feature). There is also an option
>>>> XMLResource.OPTION_DISABLE_NOTIFY which should be taken into account when
>>> this is solved.
>>>> Can you enter a bugzilla for this?
>>>> Would you be able to send in a patch (would speed up the solution
>>> considerably)?
>>>
>>>> gr. Martin
>>>
>>>> Ilya Klyuchnikov wrote:
>>>>> Martin Taal wrote:
>>>>>
>>>>>> Did you call setTrackingModification(true)?
>>>>>
>>>>>> gr. Martin
>>>>>
>>>>>> Ilya Klyuchnikov wrote:
>>>>>>> I am sorry - attached method DOES add loaded objects (to
>>>>>>> loadedObjects).
>>>>>>>
>>>>>>> Also it adds them to Resource via
>>>>>>> StoreUtil.setEResource((InternalEObject) obj, this, true);
>>>>>>>
>>>>>>> BUT IT DOESN'T SEND NOTIFICATIONS TO ADAPTERS ATTACHED TO THE
>>>>>>> RESOURCE.
>>>>>>>
>>>>>
>>>>>
>>>>> I mean another thing:
>>>>>
>>>>> In StoreUtil:
>>>>> public static void setEResource(InternalEObject eobj,
>>>>> Resource.Internal resource, boolean force) {
>>>>> if (eobj.eResource() != null && eobj.eResource() != resource
>>>>> && !force)
>>>>> return;
>>>>>
>>>>> InternalEObject currentEObject = eobj;
>>>>> while (currentEObject.eContainer() != null &&
>>>>> !currentEObject.eContainmentFeature().isResolveProxies()) {
>>>>> currentEObject = (InternalEObject)
>>>>> currentEObject.eContainer();
>>>>> AssertUtil.assertNotSameObject(currentEObject,
>>>>> currentEObject.eContainer());
>>>>> }
>>>>> currentEObject.eSetResource(resource, null);
>>>>> }
>>>>>
>>>>> currentEObject.eSetResource returns NotificationChain
>>>>> but notifications are not dispatched.
>>>>>
>>>>> For example:
>>>>> I have loaded some objects with lazy collections into
>>>>> HibernateResource. When I touch objects from lazy collection these
>>>>> objects are loaded into my resource but because notifications are not
>>>>> dispatched my adapters/listeners are not informed about loading of
>>>>> new objects from db.
>>>>>
>>>
>>>
>>>
>>>
Previous Topic:[emf.validation.ocl] Custom EnvironmentFactory for OCL constraints
Next Topic:Can Validation handle inter-model constraints?
Goto Forum:
  


Current Time: Fri Feb 26 11:08:36 GMT 2021

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

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

Back to the top