Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Riena » RCP client + Riena Equinox server + JPA/Hibernate(LazyInitException : no session or session was closed after restart server)
RCP client + Riena Equinox server + JPA/Hibernate [message #552771] Fri, 13 August 2010 09:17 Go to next message
Xino  is currently offline Xino
Messages: 18
Registered: July 2009
Junior Member
Hello,

My achitecture did change since my last thread :

I have :
1 plugin for the ui called ui plugin

1 plugin for the domain model with definitions of my data model with hibernate annotations.

1 for the services / dao.

To simplify the model:
A Pupil entity with a OneTOMany association with Subscritption entity.


1st scenario :
- Empty database
- Manually insert "Pupil"
- Update Pupil

--> everything works fine


2nd scenario :

- Stop the client
- relaunch the client
- Load the pupils
- update the pupils data
--> everything works fine


3rd scenario :
- Stop the server
- Relaunch the server
- relaunch the client
- Load the pupils
- update the pupils data
--> the famous LazyInitException : no session or session was closed with the subcription field

One more precision ;when i debbugged on the server the fields are initialzed but not on the client side.

Of course, I made some google searches but did nt fout the solution.
they more often linked with JEE containers.

I supposed it's about session, persistence context but i am a newbie about hibernate.
I don't understand why it's ok in some cases but not in others.

My question : is there some basic code samples availables within this architecture : RCP - Riena/equinox server - JPA/hibernate
just show basics CRUD operation and others best practices about configuration and so on ?


A solution for my initial issue is also welcome.

Thanks in advance.

[Updated on: Sat, 14 August 2010 03:52]

Report message to a moderator

Re: RCP client + Riena Equinox server + JPA/Hibernate [message #553034 is a reply to message #552771] Mon, 16 August 2010 03:17 Go to previous message
Stephan Mann is currently offline Stephan Mann
Messages: 22
Registered: August 2010
Junior Member
On 13.08.2010 15:17, Xino wrote:
> [..]
> --> the famous LazyInitException : no session or session was closed with
> the subcription field
> [..]
> I don't understand why it's ok in some cases but not in others.

I'm guessing here but I would bet that you get this exception the moment
you have data in your OneToMany relation. As long as there is no data,
you'll get NULL or an empty set. But if there is data, you'll get an
Hibernate specific set implementation which fails to be deserialized on
the client.

You can verify this by setting a breakpoint in your service
implementation just after the data has been retrieved from the data base
and starting the client in debug mode.

> My question : is there some basic code samples availables within this
> architecture : RCP - Riena/equinox server - JPA/hibernate
> just show basics CRUD operation and others best practices about
> configuration and so on ?

AFAIK no, sorry.

> A solution for my initial issue is also welcome.

Please refer to my newsgroup post on 2010-08-09 and the follow-up post
[1]. It describes the solution to a very similar problem we had with
EclipseLink. I expect these solutions to be applicable to Hibernate.

hth, stephan

[1]
http://www.eclipse.org/forums/index.php?t=msg&th=173378& amp;start=0&S=7e36022d7bb4c80e99d26a086f4e776c
Previous Topic:RCP client + Riena Equinox server + JPA/Hibernate
Next Topic:treeridget - the child nodes name not visible
Goto Forum:
  


Current Time: Wed Jul 23 18:19:40 EDT 2014

Powered by FUDForum. Page generated in 0.01434 seconds