Session.openSession():it creates a new session(for new session) ... if u want to work with already existing session go for Session.getCurrentSession() | 0 |
By: [email protected] On: Tue Jun 11 23:56:07 EDT 2013 0 0 0 | 0 |
Are You Satisfied :5Yes3No |
Thanks for Replay Krisinivasu I accept but i can expect more explanation please provide more explanation Advance Thanks | 0 |
By: [email protected] On: Wed Jun 12 01:08:46 EDT 2013 2 0 0 | 2 |
Are You Satisfied :2Yes2No |
getSession gives you a Hibernate session, and associates that session with the current thread. Then, if you call getSession again, you get the session that was originally created. This is good. getSession is usually sufficient. openSession provides and facilitates a greater level of management of where the session is stored and managed. It's certainly an advanced option, but one that does indeed fit the need of very clever developers who are doing some nifty things with the session. * Using getCurrentSession () the created session bound to the current thread, and the use of openSession () Session is not created * Use getCurrentSession () to create the session will automatically turn off when the commit or rollback, and using openSession () Create the session must be manually shut down using the getCurrentSession () requires in hibernate.cfg.xml file add the following configuration: * If you are using a local transaction (jdbc Affairs) <property name="hibernate.current_session_context_class"> thread </ property> * If you are using the global transaction (JTA transaction) <property name="hibernate.current_session_context_class"> jta </ property> | 0 |
By: [email protected] On: Wed Jun 12 06:02:10 EDT 2013 0 392 0 | 392 |
Are You Satisfied :6Yes2No |
Thank ravi | 0 |
By: [email protected] On: Thu Jun 13 03:44:05 EDT 2013 2 0 0 | 2 |
Are You Satisfied :0Yes0No |