|
|
|
Re: [Teneo] LazyInitializationException [message #98028 is a reply to message #98000] |
Sun, 30 September 2007 05:09 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Parvez,
Looking at the old post you refer to. The lazyinitializationexception occurs because you have
multi-threaded access to one list (correct?).
If this is the case then this exception (in this case) can only be prevented by synchronizing the
access to the list (at least when it is initializing).
After the list has been initialized then the size method should be very quick. So I do not
understand why synchronizing this method makes the system very slow. Can you check what takes so
much time there (is the cpu 100%, are there multiple threads waiting for this method, is the size
method called many times?)?
gr. Martin
PC wrote:
> Hi Martin,
>
> Here it is:
>
> 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:231)
>
> at
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:434)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:222)
> at
> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1048)
>
> at
> com.pilz.pas.platform.iface.model.impl.DepthFirstVisitorImpl .visitDeviceInterface(DepthFirstVisitorImpl.java:81)
>
> at
> com.pilz.pas.platform.iface.model.impl.DeviceInterfaceImpl.a pply(DeviceInterfaceImpl.java:282)
>
> at
> com.pilz.pas.platform.iface.model.impl.DepthFirstVisitorImpl .visitRoot(DepthFirstVisitorImpl.java:246)
>
> at
> com.pilz.pas.platform.iface.model.impl.RootImpl.apply(RootIm pl.java:178)
> at
> com.pilz.pas.platform.runtime.logic.internal.BuildManager.st artBuild(BuildManager.java:96)
>
> at
> com.pilz.pas.platform.gui.internal.jobs.DownloadBinariesJob. run(DownloadBinariesJob.java:85)
>
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
> Thanks.
> - Parvez
> Martin Taal wrote:
>> Hi,
>> Can you post the complete stacktrace?
>>
>> gr. Martin
>>
>> PC wrote:
>>> Hi,
>>>
>>> I am trying to handle LazyInitializationException in teneo 0.8.
>>>
>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg03083.html
>>>
>>>
>>> I am trying according to steps mentioned in above post (which were
>>> for 0.7.5) but didn't work.
>>>
>>>
>>> I think I may not be doing it right for 0.8.
>>>
>>> If I override & synchronize delegateSize() method in my class (which
>>> extends HibernatePersistableEList)
>>>
>>>
>>>
>>> @Override
>>> protected synchronized int delegateSize()
>>> {
>>> return super.delegateSize();
>>> }
>>> I
>>>
>>> then it works but makes the loading very very slow.
>>>
>>> If I don't override this method and just do above steps then I still
>>> get 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:231)
>>>
>>> at
>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:434)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:222)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1048)
>>>
>>> Any suggestions?
>>>
>>> Thanks.
>>
>>
--
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] LazyInitializationException [message #609853 is a reply to message #98000] |
Sun, 30 September 2007 05:09 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Parvez,
Looking at the old post you refer to. The lazyinitializationexception occurs because you have
multi-threaded access to one list (correct?).
If this is the case then this exception (in this case) can only be prevented by synchronizing the
access to the list (at least when it is initializing).
After the list has been initialized then the size method should be very quick. So I do not
understand why synchronizing this method makes the system very slow. Can you check what takes so
much time there (is the cpu 100%, are there multiple threads waiting for this method, is the size
method called many times?)?
gr. Martin
PC wrote:
> Hi Martin,
>
> Here it is:
>
> 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:231)
>
> at
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:434)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:222)
> at
> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1048)
>
> at
> com.pilz.pas.platform.iface.model.impl.DepthFirstVisitorImpl .visitDeviceInterface(DepthFirstVisitorImpl.java:81)
>
> at
> com.pilz.pas.platform.iface.model.impl.DeviceInterfaceImpl.a pply(DeviceInterfaceImpl.java:282)
>
> at
> com.pilz.pas.platform.iface.model.impl.DepthFirstVisitorImpl .visitRoot(DepthFirstVisitorImpl.java:246)
>
> at
> com.pilz.pas.platform.iface.model.impl.RootImpl.apply(RootIm pl.java:178)
> at
> com.pilz.pas.platform.runtime.logic.internal.BuildManager.st artBuild(BuildManager.java:96)
>
> at
> com.pilz.pas.platform.gui.internal.jobs.DownloadBinariesJob. run(DownloadBinariesJob.java:85)
>
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
> Thanks.
> - Parvez
> Martin Taal wrote:
>> Hi,
>> Can you post the complete stacktrace?
>>
>> gr. Martin
>>
>> PC wrote:
>>> Hi,
>>>
>>> I am trying to handle LazyInitializationException in teneo 0.8.
>>>
>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg03083.html
>>>
>>>
>>> I am trying according to steps mentioned in above post (which were
>>> for 0.7.5) but didn't work.
>>>
>>>
>>> I think I may not be doing it right for 0.8.
>>>
>>> If I override & synchronize delegateSize() method in my class (which
>>> extends HibernatePersistableEList)
>>>
>>>
>>>
>>> @Override
>>> protected synchronized int delegateSize()
>>> {
>>> return super.delegateSize();
>>> }
>>> I
>>>
>>> then it works but makes the loading very very slow.
>>>
>>> If I don't override this method and just do above steps then I still
>>> get 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:231)
>>>
>>> at
>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:434)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:222)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.hasNex t(DelegatingEList.java:1048)
>>>
>>> Any suggestions?
>>>
>>> Thanks.
>>
>>
--
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
|
|
|
Powered by
FUDForum. Page generated in 0.04199 seconds