Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] AbstractPersistentCollection crashes when Product is exported
[Teneo] AbstractPersistentCollection crashes when Product is exported [message #846821] Mon, 16 April 2012 19:38 Go to next message
Mauricio Reyes is currently offline Mauricio ReyesFriend
Messages: 26
Registered: August 2011
Junior Member
Hi, I'm having a problem with an RCP client-server app based in EMF that crashes when the product is exported and I run it outside Eclipse.
The exception I get is always:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: <anyEClass>.<anyMultipleEReference>, no session or session was closed (where anyEClass and anyMultipleEReference are EMF EClass and EReference respectively)

I'm working with an RCP app that extends Teneo's HibernatePersistableEList, where I've extended it so I can invoke the server through custom logic when the doLoad() is called. Everything works perfect within Eclipse, but after I export the Product I get LazyInitializationException everytime the PersistentList is called after first load (my PersistableEList is filled with data from server, but all the multiple references of their contents can't be loaded).

E.g. One case is crashes in org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:122) and like the others, this happens always that !initialized is checked.

Is there something I'm missing when making the Product Export? Maybe some plugin that has some connection and isn't being included? Or is purely Hibernate session managing that works ok inside Eclipse? I think that the second option is where I've some problem, but I'm feeling a bit (or not just a bit) lost with this.

I'll appreciate any help to understand the situation and where and how Teneo/Hibernate uses initialized.

Mauricio

[Updated on: Mon, 16 April 2012 19:38]

Report message to a moderator

Re: [Teneo] AbstractPersistentCollection crashes when Product is exported [message #846854 is a reply to message #846821] Mon, 16 April 2012 20:18 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Mauricio,
This is related to session management. The session used during the export is closed and then the persistent collection
is accessed after that.

How/where do you get the hibernate session from and do you close it somewhere? How do you do the export?

gr. Martin


On 04/16/2012 09:38 PM, Mauricio Reyes wrote:
> Hi, I'm having a problem with an RCP client-server app based in EMF that crashes when the product is exported and I run
> it outside Eclipse.
> The exception I get is always:
> org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:
> <anyEClass>.<anyMultipleEReference>, no session or session was closed (where anyEClass is and anyMultipleEReference are
> EMF EClass and EReference respectively)
>
> I'm working with an RCP app that extends Teneo's HibernatePersistableEList, where I've extended it so I can invoke the
> server through custom logic when the doLoad() is called. Everything works perfect within Eclipse, but after I export the
> Product I get LazyInitializationException everytime the PersistentList is called after first load (my PersistableEList
> is filled with data from server, but all the multiple references of their contents can't be loaded).
> E.g. One case is crashes in
> org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:122) and like the
> others, this happens always that !initialized is checked.
>
> Is there something I'm missing when making the Product Export? Maybe some plugin that has some connection and isn't
> being included? Or is purely Hibernate session managing that works ok inside Eclipse? I think that the second option is
> where I've some problem, but I'm feeling a bit (or not just a bit) lost with this.
>
> I'll appreciate any help to understand the situation and where and how Teneo/Hibernate uses initialized.
>
> Mauricio


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] AbstractPersistentCollection crashes when Product is exported [message #847694 is a reply to message #846854] Tue, 17 April 2012 15:07 Go to previous messageGo to next message
Mauricio Reyes is currently offline Mauricio ReyesFriend
Messages: 26
Registered: August 2011
Junior Member
Martin, first of all, thanks for the quick response. About the problem, I think I should explain better the export.
I run and debug the application inside de IDE without any problem. I have the classic EMF Model, Edit and Editor plugin with modifications but without any major change to the structure, and I've created a .product file to export the whole project outside Eclipse. So, the export process is done with the Export wizard provided by the product, and my project is a plugin based app. In the Dependencies tab I've all the plugins required by the app.

The hibernate session is obtained when I invoke the server to load my extension of HibernatePersistableEList, but I'm not getting the session back from server. When I debug the process the org.hibernate.collection.PersistentList has no session (is null), the initialized variable is set to true, and I see the ArrayList containing all the referenced object (I use the PersistableEList in every multiple reference so I load them on demand). The PersistableEList containing the PersistentList has its isLoaded variable as true.
So, everything works without problems while debugging, but when I try to run the exported from Eclipse RCP app, things change, and LazyInitialization is throwed everytime I try to access to any method that checks with !initialized.

The fact that I don't receive the session from server can be related to the problem? When I check the PersistentList received from server during debug I always see initialized in true. I tend to think that inside the Eclipse environment there's something that's missing outside, but I can't figure out what is it. Maybe a plugin or something else.

Let me know if you need any other detail about the architecture or the implementation.

Thanks in advance
Mauricio
Re: [Teneo] AbstractPersistentCollection crashes when Product is exported [message #847813 is a reply to message #847694] Tue, 17 April 2012 17:17 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Mauricio,
Sorry, I don't understand how you obtain the hibernate session or how you manage/control it. Do you start your own
transaction? Do you use hibernate EMF resources?

gr. Martin

On 04/17/2012 05:07 PM, Mauricio Reyes wrote:
> Martin, first of all, thanks for the quick response. About the problem, I think I should explain better the export.
> I run and debug the application inside de IDE without any problem. I have the classic EMF Model, Edit and Editor plugin
> with modifications but without any major change to the structure, and I've created a .product file to export the whole
> project outside Eclipse. So, the export process is done with the Export wizard provided by the product, and my project
> is a plugin based app. In the Dependencies tab I've all the plugins required by the app.
>
> The hibernate session is obtained when I invoke the server to load my extension of HibernatePersistableEList, but I'm
> not getting the session back from server. When I debug the process the org.hibernate.collection.PersistentList has no
> session (is null), the initialized variable is set to true, and I see the ArrayList containing all the referenced object
> (I use the PersistableEList in every multiple reference so I load them on demand). The PersistableEList containing the
> PersistentList has its isLoaded variable as true.
> So, everything works without problems while debugging, but when I try to run the exported from Eclipse RCP app, things
> change, and LazyInitialization is throwed everytime I try to access to any method that checks with !initialized.
>
> The fact that I don't receive the session from server can be related to the problem? When I check the PersistentList
> received from server during debug I always see initialized in true. I tend to think that inside the Eclipse environment
> there's something that's missing outside, but I can't figure out what is it. Maybe a plugin or something else.
>
> Let me know if you need any other detail about the architecture or the implementation.
>
> Thanks in advance
> Mauricio


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] AbstractPersistentCollection crashes when Product is exported [message #847867 is a reply to message #847813] Tue, 17 April 2012 18:29 Go to previous messageGo to next message
Mauricio Reyes is currently offline Mauricio ReyesFriend
Messages: 26
Registered: August 2011
Junior Member
I'm having the problems at client side, where I don't make use of the session. The lazy loading at client side is done when a collection is tried to be accessed and isn't loaded. What I've done is override the doLoad() to invoke an EJB where I ask for the collection sending to the server the owner id and the feature id. At server side the collection is loaded from DB with Teneo/Hibernate, and the MyPersistableEList loaded is then sent back to the client, where I have the same implementation except for the doLoad() that has the logic I've explained. When I get an eObject from the server, all their multiple eReferences come as MyPersistableEList with isLoaded set to false. When I ask the owner for any object of its lists or the size of one of them, everything works like in the server, checking first is the MyPersistableEList is loaded and doing the custom doLoad() if is not.

That's why I don't focus on the session, because when data isn't loaded I ask the server and I receive from it the MyPersistableEList with its PersistentList with all the eObjects and variables set.

I'm uploading a basic diagram with the main plugins at client side and components at server side trying to do the explanation easier: h ttp://i39.tinypic.com/2q0vltu.png

Thanks for your time
Regards
Mauricio
Re: [Teneo] AbstractPersistentCollection crashes when Product is exported [message #847869 is a reply to message #847813] Tue, 17 April 2012 18:30 Go to previous messageGo to next message
Mauricio Reyes is currently offline Mauricio ReyesFriend
Messages: 26
Registered: August 2011
Junior Member
I'm having the problems at client side, where I don't make use of the session. The lazy loading at client side is done when a collection is tried to be accessed and isn't loaded. What I've done is override the doLoad() to invoke an EJB where I ask for the collection sending to the server the owner id and the feature id. At server side the collection is loaded from DB with Teneo/Hibernate, and the MyPersistableEList loaded is then sent back to the client, where I have the same implementation except for the doLoad() that has the logic I've explained. When I get an eObject from the server, all their multiple eReferences come as MyPersistableEList with isLoaded set to false. When I ask the owner for any object of its lists or the size of one of them, everything works like in the server, checking first is the MyPersistableEList is loaded and doing the custom doLoad() if is not.

That's why I don't focus on the session, because when data isn't loaded I ask the server and I receive from it the MyPersistableEList with its PersistentList with all the eObjects and variables set.

I'm attaching a basic diagram with the main plugins at client side and components at server side trying to do the explanation easier: i39.tinypic.com/2q0vltu.png

Thanks for your time
Regards
Mauricio
Re: [Teneo] AbstractPersistentCollection crashes when Product is exported [message #847989 is a reply to message #847869] Tue, 17 April 2012 21:11 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Mauricio,
My first thought is that you should not be using a PersistableEList on the client, these types of elists only make sense
when running the same tier as hibernate.

So on the client I would extend an EMF XMI/XMLResource and work from that.

gr. Martin

On 04/17/2012 08:30 PM, Mauricio Reyes wrote:
> I'm having the problems at client side, where I don't make use of the session. The lazy loading at client side is done
> when a collection is tried to be accessed and isn't loaded. What I've done is override the doLoad() to invoke an EJB
> where I ask for the collection sending to the server the owner id and the feature id. At server side the collection is
> loaded from DB with Teneo/Hibernate, and the MyPersistableEList loaded is then sent back to the client, where I have the
> same implementation except for the doLoad() that has the logic I've explained. When I get an eObject from the server,
> all their multiple eReferences come as MyPersistableEList with isLoaded set to false. When I ask the owner for any
> object of its lists or the size of one of them, everything works like in the server, checking first is the
> MyPersistableEList is loaded and doing the custom doLoad() if is not.
> That's why I don't focus on the session, because when data isn't loaded I ask the server and I receive from it the
> MyPersistableEList with its PersistentList with all the eObjects and variables set.
>
> I'm attaching a basic diagram with the main plugins at client side and components at server side trying to do the
> explanation easier: i39.tinypic.com/2q0vltu.png
>
> Thanks for your time
> Regards
> Mauricio


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] AbstractPersistentCollection crashes when Product is exported [message #847990 is a reply to message #847813] Tue, 17 April 2012 21:15 Go to previous message
Mauricio Reyes is currently offline Mauricio ReyesFriend
Messages: 26
Registered: August 2011
Junior Member
Hi Martin, I'm still with the investigation of this exception and found out that is related with the connection of my integration plugin with the EJB, so Teneo is probably out of this. If I find that maybe related I ask again through this forum.

Thanks for your advice

Mauricio
Previous Topic:[EEF] Does EEF use property descriptors?
Next Topic:[Texo] NamedQuery annotation is not correct
Goto Forum:
  


Current Time: Fri Apr 19 01:54:28 GMT 2024

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

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

Back to the top