Stateful removal

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Stateful removal

Jean-Sébastien Scrève
Hi,

My configuration is the following : Open 3.1, hibernate 3.2.6.

I have a question regarding stateful removal:

I retrieve an entity with a stateful object. I navigate through relations and everything works fine.
I then call an @Remove method on the stateful. I kept a reference on my entity so I try to navigate through the relation again and everything works still fine.
I expected a LazyLoadingException to occur once I removed my stateful (1-n relationship). Is that right ? In fact Embedded Jboss throws the lazy loading exception under the same circumstances.
I haven't tested it yet but I think the correction would be easy : a close() on the EntityManager would do.
I'll investigate more when I have time to.

Thanks,

Jean-Sébastien Scrève.
Reply | Threaded
Open this post in threaded view
|

Re: Stateful removal

Dain Sundstrom
I checked the code and we don't close the EntityManager when the  
stateful bean is removed.  Do you know if this is a spec defined  
behavior or something that JBoss just does?

Also, if this code is called from within a JTA transaction, I wouldn't  
expect the EntityManager to be closed until the end of the transaction.

-dain

On Dec 8, 2008, at 9:10 AM, Jean-Sébastien Scrève wrote:

>
> Hi,
>
> My configuration is the following : Open 3.1, hibernate 3.2.6.
>
> I have a question regarding stateful removal:
>
> I retrieve an entity with a stateful object. I navigate through  
> relations
> and everything works fine.
> I then call an @Remove method on the stateful. I kept a reference on  
> my
> entity so I try to navigate through the relation again and  
> everything works
> still fine.
> I expected a LazyLoadingException to occur once I removed my  
> stateful (1-n
> relationship). Is that right ? In fact Embedded Jboss throws the lazy
> loading exception under the same circumstances.
> I haven't tested it yet but I think the correction would be easy : a  
> close()
> on the EntityManager would do.
> I'll investigate more when I have time to.
>
> Thanks,
>
> Jean-Sébastien Scrève.
> --
> View this message in context: http://www.nabble.com/Stateful-removal-tp20899366p20899366.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: Stateful removal

Jean-Sébastien Scrève
I checked the spec and I cannot find anything about it.

It's just that I tought it would be logic. What do you think ?


Dain Sundstrom wrote
I checked the code and we don't close the EntityManager when the  
stateful bean is removed.  Do you know if this is a spec defined  
behavior or something that JBoss just does?

Also, if this code is called from within a JTA transaction, I wouldn't  
expect the EntityManager to be closed until the end of the transaction.

-dain

On Dec 8, 2008, at 9:10 AM, Jean-Sébastien Scrève wrote:

>
> Hi,
>
> My configuration is the following : Open 3.1, hibernate 3.2.6.
>
> I have a question regarding stateful removal:
>
> I retrieve an entity with a stateful object. I navigate through  
> relations
> and everything works fine.
> I then call an @Remove method on the stateful. I kept a reference on  
> my
> entity so I try to navigate through the relation again and  
> everything works
> still fine.
> I expected a LazyLoadingException to occur once I removed my  
> stateful (1-n
> relationship). Is that right ? In fact Embedded Jboss throws the lazy
> loading exception under the same circumstances.
> I haven't tested it yet but I think the correction would be easy : a  
> close()
> on the EntityManager would do.
> I'll investigate more when I have time to.
>
> Thanks,
>
> Jean-Sébastien Scrève.
> --
> View this message in context: http://www.nabble.com/Stateful-removal-tp20899366p20899366.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>