-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: SessionContext - which one to use in JSE applictaion?
PostPosted: Mon Jun 25, 2012 8:41 am 
Newbie

Joined: Mon Jun 25, 2012 7:33 am
Posts: 4
I am new in Hibernate and some things (like Session Contexts) are not clear for me. I understand all issues connected with Persistence Context in JPA but here (in Hibernate), the description from documenation about Session Contexts is not comprehensive enouhg.

In documenation of Hibernate 3.6 there are mentioned 3 types of SessionContexs:
1. org.hibernate.context.internal.JTASessionContext

2. org.hibernate.context.internal.ThreadLocalSessionContext

3. org.hibernate.context.internal.ManagedSessionContext

As I was looking through some examples of hibernate.cfg.xml configuration files I saw that "thread" context is applied (in cfg.xml) in the most cases.

In documenattion of Hiberante 4.1 there are mentione d only too types of context scope:

1. org.hibernate.context.internal.JTASessionContext

2. org.hibernate.context.internal.ManagedSessionContext

A. Does it mean that org.hibernate.context.internal.ThreadLocalSessionContext is discarded in Hibernate 4.1? Is it not allowed to use it in Hib. 4.1?
I have also some other questions:

B. If the property connected with Context ( <property name="current_session_context_class">) in cfg.xml file is not set which one is used as deafult (for both verions of Hib. 3.x and 4.x )?

C. Which Session Context should I set for appliction working in J2SE environment (for both verions of Hib. 3.x and 4.x )? I assume that
JTASessionContext is inappropriate ?

D. ManagedSessionContext is not clear for me. I don't understand the usage of "bind()" and "unbind()". It is written (in docs) that "bind()":
"Binds the given session to the current context for its session factory." Does it mean that there is a one SessionContext for SessionFactory and it can be used in many transaction and can be bind to any Session object that was created by this Session Factory? The end of the transaction doesn't clear it and close it?

If you can answer for any of those question I will be grateful.


Top
 Profile  
 
 Post subject: Re: SessionContext - which one to use in JSE applictaion?
PostPosted: Wed Jun 27, 2012 1:29 am 
Newbie

Joined: Mon Jun 25, 2012 7:33 am
Posts: 4
Does anyone know something about it?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.