Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Lazy loading exception
[Teneo] Lazy loading exception [message #89737] Fri, 13 July 2007 11:03 Go to next message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi,

We have number of emf models and nearly all have lazy initialization.

The problem is due to number of threads working asynchronously due to
user's action leaving GUI active. When one thread is accessing a model
class and if it is first time then list gets loaded (e.g.
obj.getChildren() ) and that works fine. But if at the same time another
thread tries to access the same when objects are being loaded because of
another thread then it throws error:

org.hibernate.LazyInitializationException: illegal access to loading
collection
at
org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
at
org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at
org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
at org.hibernate.collection.PersistentList.size(PersistentList. java:91)
at
org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
at
org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
at
org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)


So I am just wondering if there is some solution/suggestion for this
problem.

Thanks.
PS: Using emf 2.2, teneo 0.7.5
Re: [Teneo] Lazy loading exception [message #89753 is a reply to message #89737] Fri, 13 July 2007 11:37 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
It is a complex issue because hibernate session are not multi-threaded. In the ideal world only one
thread at the time has access to a model object (tree). So if you can synchronize access to
'uninitialized' model objects then that would help.

What could help for this case is to ensure that when a persistable list is loading that no one else
can access it (make it synchronized it in specific places). If you want to go down this road then
let me know I can give you some hints on how to do this.
However, fighting this symptom does not guarantee that no other issues will arise (because a hb
session is not multi-threaded).

gr. Martin

PC wrote:
> Hi,
>
> We have number of emf models and nearly all have lazy initialization.
>
> The problem is due to number of threads working asynchronously due to
> user's action leaving GUI active. When one thread is accessing a model
> class and if it is first time then list gets loaded (e.g.
> obj.getChildren() ) and that works fine. But if at the same time another
> thread tries to access the same when objects are being loaded because of
> another thread then it throws error:
>
> org.hibernate.LazyInitializationException: illegal access to loading
> collection
> at
> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
>
> at
> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>
> at
> org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
>
> at org.hibernate.collection.PersistentList.size(PersistentList. java:91)
> at
> org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
>
> at
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
> at
> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)
>
>
>
> So I am just wondering if there is some solution/suggestion for this
> problem.
>
> Thanks.
> PS: Using emf 2.2, teneo 0.7.5


--

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] Lazy loading exception [message #89782 is a reply to message #89753] Fri, 13 July 2007 13:37 Go to previous messageGo to next message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi Martin,
Thanks for feedback.
Yes, any hints/suggestions will be appreciated.
At the moment, as a fix and to check, at one place what I did is, put
that code in a loop and comes out when it doesn't throw that particular
error or otherwise. And that worked. But I don't want to go to that
route as it is not clean and another thing that this way it is not
possible to cover everything until unless we put such ugly code everywhere.
Synchronizing generated model will be difficult, again too much code.
So another thought is if some of teneo methods (relevant to lazy loading
concept) can be synchronized then that should fix, will it? like
org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)

Thanks.


Martin Taal wrote:
> Hi,
> It is a complex issue because hibernate session are not multi-threaded.
> In the ideal world only one thread at the time has access to a model
> object (tree). So if you can synchronize access to 'uninitialized' model
> objects then that would help.
>
> What could help for this case is to ensure that when a persistable list
> is loading that no one else can access it (make it synchronized it in
> specific places). If you want to go down this road then let me know I
> can give you some hints on how to do this.
> However, fighting this symptom does not guarantee that no other issues
> will arise (because a hb session is not multi-threaded).
>
> gr. Martin
>
> PC wrote:
>> Hi,
>>
>> We have number of emf models and nearly all have lazy initialization.
>>
>> The problem is due to number of threads working asynchronously due to
>> user's action leaving GUI active. When one thread is accessing a model
>> class and if it is first time then list gets loaded (e.g.
>> obj.getChildren() ) and that works fine. But if at the same time
>> another thread tries to access the same when objects are being loaded
>> because of another thread then it throws error:
>>
>> org.hibernate.LazyInitializationException: illegal access to loading
>> collection
>> at
>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
>>
>> at
>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>
>> at
>> org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
>>
>> at
>> org.hibernate.collection.PersistentList.size(PersistentList. java:91)
>> at
>> org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
>>
>> at
>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>>
>> at
>> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
>>
>> at
>> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)
>>
>>
>> So I am just wondering if there is some solution/suggestion for
>> this problem.
>>
>> Thanks.
>> PS: Using emf 2.2, teneo 0.7.5
>
>
Re: [Teneo] Lazy loading exception [message #89796 is a reply to message #89782] Fri, 13 July 2007 14:12 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
In the new version this is easier to do but for the 0.7.5 version the following needs to be done:

1) Create a subclass of HibernatePersistableEList, override only the getDelegate method and
synchronize it.
2) Create a subclass of EListPropertyHandler and override the createPersistableList method. Instead
of creating the standard HibernatePeristableEList in this method create your elist (step 1)
3) Create a subclass of HbContextImpl and override the method createEListAccessor which should
return an instance of the class you created in step 2
4) Create a subclass of HbDataStore and override the getHbContext method, return an instance of the
HbContextImpl class you created in step 3.

There are a number of classes to override but the override step is very simple (only one method)
each time.

gr. Martin

PC wrote:
> Hi Martin,
> Thanks for feedback.
> Yes, any hints/suggestions will be appreciated.
> At the moment, as a fix and to check, at one place what I did is, put
> that code in a loop and comes out when it doesn't throw that particular
> error or otherwise. And that worked. But I don't want to go to that
> route as it is not clean and another thing that this way it is not
> possible to cover everything until unless we put such ugly code everywhere.
> Synchronizing generated model will be difficult, again too much code.
> So another thought is if some of teneo methods (relevant to lazy loading
> concept) can be synchronized then that should fix, will it? like
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>
>
> Thanks.
>
>
> Martin Taal wrote:
>> Hi,
>> It is a complex issue because hibernate session are not
>> multi-threaded. In the ideal world only one thread at the time has
>> access to a model object (tree). So if you can synchronize access to
>> 'uninitialized' model objects then that would help.
>>
>> What could help for this case is to ensure that when a persistable
>> list is loading that no one else can access it (make it synchronized
>> it in specific places). If you want to go down this road then let me
>> know I can give you some hints on how to do this.
>> However, fighting this symptom does not guarantee that no other issues
>> will arise (because a hb session is not multi-threaded).
>>
>> gr. Martin
>>
>> PC wrote:
>>> Hi,
>>>
>>> We have number of emf models and nearly all have lazy initialization.
>>>
>>> The problem is due to number of threads working asynchronously due to
>>> user's action leaving GUI active. When one thread is accessing a
>>> model class and if it is first time then list gets loaded (e.g.
>>> obj.getChildren() ) and that works fine. But if at the same time
>>> another thread tries to access the same when objects are being loaded
>>> because of another thread then it throws error:
>>>
>>> org.hibernate.LazyInitializationException: illegal access to loading
>>> collection
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
>>>
>>> at
>>> org.hibernate.collection.PersistentList.size(PersistentList. java:91)
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
>>>
>>> at
>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)
>>>
>>>
>>> So I am just wondering if there is some solution/suggestion for
>>> this problem.
>>>
>>> Thanks.
>>> PS: Using emf 2.2, teneo 0.7.5
>>
>>


--

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] Lazy loading exception [message #89837 is a reply to message #89796] Mon, 16 July 2007 09:32 Go to previous message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
That’s great Martin, thanks.
This month we are intending to upgrade to eclipse 3.3 and so we will
also use new version of emf and teneo. So I guess I will do this fix as
per new version of teneo. Hopefully, I think it will be easy to figure
out the same for the new version of teneo as per your comments. But if
there are some specifics which I should do for new version of teneo then
please do let me know. And again as always help much appreciated.

- Parvez

Martin Taal wrote:
> In the new version this is easier to do but for the 0.7.5 version the
> following needs to be done:
>
> 1) Create a subclass of HibernatePersistableEList, override only the
> getDelegate method and synchronize it.
> 2) Create a subclass of EListPropertyHandler and override the
> createPersistableList method. Instead of creating the standard
> HibernatePeristableEList in this method create your elist (step 1)
> 3) Create a subclass of HbContextImpl and override the method
> createEListAccessor which should return an instance of the class you
> created in step 2
> 4) Create a subclass of HbDataStore and override the getHbContext
> method, return an instance of the HbContextImpl class you created in
> step 3.
>
> There are a number of classes to override but the override step is very
> simple (only one method) each time.
>
> gr. Martin
>
> PC wrote:
>> Hi Martin,
>> Thanks for feedback.
>> Yes, any hints/suggestions will be appreciated.
>> At the moment, as a fix and to check, at one place what I did is, put
>> that code in a loop and comes out when it doesn't throw that
>> particular error or otherwise. And that worked. But I don't want to go
>> to that route as it is not clean and another thing that this way it is
>> not possible to cover everything until unless we put such ugly code
>> everywhere.
>> Synchronizing generated model will be difficult, again too much code.
>> So another thought is if some of teneo methods (relevant to lazy
>> loading concept) can be synchronized then that should fix, will it?
>> like
>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>>
>>
>> Thanks.
>>
>>
>> Martin Taal wrote:
>>> Hi,
>>> It is a complex issue because hibernate session are not
>>> multi-threaded. In the ideal world only one thread at the time has
>>> access to a model object (tree). So if you can synchronize access to
>>> 'uninitialized' model objects then that would help.
>>>
>>> What could help for this case is to ensure that when a persistable
>>> list is loading that no one else can access it (make it synchronized
>>> it in specific places). If you want to go down this road then let me
>>> know I can give you some hints on how to do this.
>>> However, fighting this symptom does not guarantee that no other
>>> issues will arise (because a hb session is not multi-threaded).
>>>
>>> gr. Martin
>>>
>>> PC wrote:
>>>> Hi,
>>>>
>>>> We have number of emf models and nearly all have lazy initialization.
>>>>
>>>> The problem is due to number of threads working asynchronously due
>>>> to user's action leaving GUI active. When one thread is accessing a
>>>> model class and if it is first time then list gets loaded (e.g.
>>>> obj.getChildren() ) and that works fine. But if at the same time
>>>> another thread tries to access the same when objects are being
>>>> loaded because of another thread then it throws error:
>>>>
>>>> org.hibernate.LazyInitializationException: illegal access to loading
>>>> collection
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
>>>>
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
>>>>
>>>> at
>>>> org.hibernate.collection.PersistentList.size(PersistentList. java:91)
>>>> at
>>>> org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>>>>
>>>> at
>>>> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
>>>>
>>>> at
>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)
>>>>
>>>>
>>>> So I am just wondering if there is some solution/suggestion for
>>>> this problem.
>>>>
>>>> Thanks.
>>>> PS: Using emf 2.2, teneo 0.7.5
>>>
>>>
>
>
Re: [Teneo] Lazy loading exception [message #608745 is a reply to message #89737] Fri, 13 July 2007 11:37 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
It is a complex issue because hibernate session are not multi-threaded. In the ideal world only one
thread at the time has access to a model object (tree). So if you can synchronize access to
'uninitialized' model objects then that would help.

What could help for this case is to ensure that when a persistable list is loading that no one else
can access it (make it synchronized it in specific places). If you want to go down this road then
let me know I can give you some hints on how to do this.
However, fighting this symptom does not guarantee that no other issues will arise (because a hb
session is not multi-threaded).

gr. Martin

PC wrote:
> Hi,
>
> We have number of emf models and nearly all have lazy initialization.
>
> The problem is due to number of threads working asynchronously due to
> user's action leaving GUI active. When one thread is accessing a model
> class and if it is first time then list gets loaded (e.g.
> obj.getChildren() ) and that works fine. But if at the same time another
> thread tries to access the same when objects are being loaded because of
> another thread then it throws error:
>
> org.hibernate.LazyInitializationException: illegal access to loading
> collection
> at
> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
>
> at
> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>
> at
> org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
>
> at org.hibernate.collection.PersistentList.size(PersistentList. java:91)
> at
> org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
>
> at
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
> at
> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)
>
>
>
> So I am just wondering if there is some solution/suggestion for this
> problem.
>
> Thanks.
> PS: Using emf 2.2, teneo 0.7.5


--

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] Lazy loading exception [message #608747 is a reply to message #89753] Fri, 13 July 2007 13:37 Go to previous message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi Martin,
Thanks for feedback.
Yes, any hints/suggestions will be appreciated.
At the moment, as a fix and to check, at one place what I did is, put
that code in a loop and comes out when it doesn't throw that particular
error or otherwise. And that worked. But I don't want to go to that
route as it is not clean and another thing that this way it is not
possible to cover everything until unless we put such ugly code everywhere.
Synchronizing generated model will be difficult, again too much code.
So another thought is if some of teneo methods (relevant to lazy loading
concept) can be synchronized then that should fix, will it? like
org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)

Thanks.


Martin Taal wrote:
> Hi,
> It is a complex issue because hibernate session are not multi-threaded.
> In the ideal world only one thread at the time has access to a model
> object (tree). So if you can synchronize access to 'uninitialized' model
> objects then that would help.
>
> What could help for this case is to ensure that when a persistable list
> is loading that no one else can access it (make it synchronized it in
> specific places). If you want to go down this road then let me know I
> can give you some hints on how to do this.
> However, fighting this symptom does not guarantee that no other issues
> will arise (because a hb session is not multi-threaded).
>
> gr. Martin
>
> PC wrote:
>> Hi,
>>
>> We have number of emf models and nearly all have lazy initialization.
>>
>> The problem is due to number of threads working asynchronously due to
>> user's action leaving GUI active. When one thread is accessing a model
>> class and if it is first time then list gets loaded (e.g.
>> obj.getChildren() ) and that works fine. But if at the same time
>> another thread tries to access the same when objects are being loaded
>> because of another thread then it throws error:
>>
>> org.hibernate.LazyInitializationException: illegal access to loading
>> collection
>> at
>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
>>
>> at
>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>
>> at
>> org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
>>
>> at
>> org.hibernate.collection.PersistentList.size(PersistentList. java:91)
>> at
>> org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
>>
>> at
>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>>
>> at
>> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
>>
>> at
>> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)
>>
>>
>> So I am just wondering if there is some solution/suggestion for
>> this problem.
>>
>> Thanks.
>> PS: Using emf 2.2, teneo 0.7.5
>
>
Re: [Teneo] Lazy loading exception [message #608748 is a reply to message #89782] Fri, 13 July 2007 14:12 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
In the new version this is easier to do but for the 0.7.5 version the following needs to be done:

1) Create a subclass of HibernatePersistableEList, override only the getDelegate method and
synchronize it.
2) Create a subclass of EListPropertyHandler and override the createPersistableList method. Instead
of creating the standard HibernatePeristableEList in this method create your elist (step 1)
3) Create a subclass of HbContextImpl and override the method createEListAccessor which should
return an instance of the class you created in step 2
4) Create a subclass of HbDataStore and override the getHbContext method, return an instance of the
HbContextImpl class you created in step 3.

There are a number of classes to override but the override step is very simple (only one method)
each time.

gr. Martin

PC wrote:
> Hi Martin,
> Thanks for feedback.
> Yes, any hints/suggestions will be appreciated.
> At the moment, as a fix and to check, at one place what I did is, put
> that code in a loop and comes out when it doesn't throw that particular
> error or otherwise. And that worked. But I don't want to go to that
> route as it is not clean and another thing that this way it is not
> possible to cover everything until unless we put such ugly code everywhere.
> Synchronizing generated model will be difficult, again too much code.
> So another thought is if some of teneo methods (relevant to lazy loading
> concept) can be synchronized then that should fix, will it? like
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>
>
> Thanks.
>
>
> Martin Taal wrote:
>> Hi,
>> It is a complex issue because hibernate session are not
>> multi-threaded. In the ideal world only one thread at the time has
>> access to a model object (tree). So if you can synchronize access to
>> 'uninitialized' model objects then that would help.
>>
>> What could help for this case is to ensure that when a persistable
>> list is loading that no one else can access it (make it synchronized
>> it in specific places). If you want to go down this road then let me
>> know I can give you some hints on how to do this.
>> However, fighting this symptom does not guarantee that no other issues
>> will arise (because a hb session is not multi-threaded).
>>
>> gr. Martin
>>
>> PC wrote:
>>> Hi,
>>>
>>> We have number of emf models and nearly all have lazy initialization.
>>>
>>> The problem is due to number of threads working asynchronously due to
>>> user's action leaving GUI active. When one thread is accessing a
>>> model class and if it is first time then list gets loaded (e.g.
>>> obj.getChildren() ) and that works fine. But if at the same time
>>> another thread tries to access the same when objects are being loaded
>>> because of another thread then it throws error:
>>>
>>> org.hibernate.LazyInitializationException: illegal access to loading
>>> collection
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
>>>
>>> at
>>> org.hibernate.collection.PersistentList.size(PersistentList. java:91)
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
>>>
>>> at
>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)
>>>
>>>
>>> So I am just wondering if there is some solution/suggestion for
>>> this problem.
>>>
>>> Thanks.
>>> PS: Using emf 2.2, teneo 0.7.5
>>
>>


--

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] Lazy loading exception [message #608751 is a reply to message #89796] Mon, 16 July 2007 09:32 Go to previous message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
That’s great Martin, thanks.
This month we are intending to upgrade to eclipse 3.3 and so we will
also use new version of emf and teneo. So I guess I will do this fix as
per new version of teneo. Hopefully, I think it will be easy to figure
out the same for the new version of teneo as per your comments. But if
there are some specifics which I should do for new version of teneo then
please do let me know. And again as always help much appreciated.

- Parvez

Martin Taal wrote:
> In the new version this is easier to do but for the 0.7.5 version the
> following needs to be done:
>
> 1) Create a subclass of HibernatePersistableEList, override only the
> getDelegate method and synchronize it.
> 2) Create a subclass of EListPropertyHandler and override the
> createPersistableList method. Instead of creating the standard
> HibernatePeristableEList in this method create your elist (step 1)
> 3) Create a subclass of HbContextImpl and override the method
> createEListAccessor which should return an instance of the class you
> created in step 2
> 4) Create a subclass of HbDataStore and override the getHbContext
> method, return an instance of the HbContextImpl class you created in
> step 3.
>
> There are a number of classes to override but the override step is very
> simple (only one method) each time.
>
> gr. Martin
>
> PC wrote:
>> Hi Martin,
>> Thanks for feedback.
>> Yes, any hints/suggestions will be appreciated.
>> At the moment, as a fix and to check, at one place what I did is, put
>> that code in a loop and comes out when it doesn't throw that
>> particular error or otherwise. And that worked. But I don't want to go
>> to that route as it is not clean and another thing that this way it is
>> not possible to cover everything until unless we put such ugly code
>> everywhere.
>> Synchronizing generated model will be difficult, again too much code.
>> So another thought is if some of teneo methods (relevant to lazy
>> loading concept) can be synchronized then that should fix, will it?
>> like
>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>>
>>
>> Thanks.
>>
>>
>> Martin Taal wrote:
>>> Hi,
>>> It is a complex issue because hibernate session are not
>>> multi-threaded. In the ideal world only one thread at the time has
>>> access to a model object (tree). So if you can synchronize access to
>>> 'uninitialized' model objects then that would help.
>>>
>>> What could help for this case is to ensure that when a persistable
>>> list is loading that no one else can access it (make it synchronized
>>> it in specific places). If you want to go down this road then let me
>>> know I can give you some hints on how to do this.
>>> However, fighting this symptom does not guarantee that no other
>>> issues will arise (because a hb session is not multi-threaded).
>>>
>>> gr. Martin
>>>
>>> PC wrote:
>>>> Hi,
>>>>
>>>> We have number of emf models and nearly all have lazy initialization.
>>>>
>>>> The problem is due to number of threads working asynchronously due
>>>> to user's action leaving GUI active. When one thread is accessing a
>>>> model class and if it is first time then list gets loaded (e.g.
>>>> obj.getChildren() ) and that works fine. But if at the same time
>>>> another thread tries to access the same when objects are being
>>>> loaded because of another thread then it throws error:
>>>>
>>>> org.hibernate.LazyInitializationException: illegal access to loading
>>>> collection
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
>>>>
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.readSi ze(AbstractPersistentCollection.java:109)
>>>>
>>>> at
>>>> org.hibernate.collection.PersistentList.size(PersistentList. java:91)
>>>> at
>>>> org.eclipse.emf.common.util.DelegatingEList.delegateSize(Del egatingEList.java:223)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:401)
>>>>
>>>> at
>>>> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
>>>>
>>>> at
>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1000)
>>>>
>>>>
>>>> So I am just wondering if there is some solution/suggestion for
>>>> this problem.
>>>>
>>>> Thanks.
>>>> PS: Using emf 2.2, teneo 0.7.5
>>>
>>>
>
>
Previous Topic:"does not translate to an instance class"
Next Topic:[EMF Compare] schema for MatchEngine missing
Goto Forum:
  


Current Time: Thu Mar 28 09:29:32 GMT 2024

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

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

Back to the top