Why session is not thread safe in hibernate?



Why session is not thread safe in hibernate?..

Answer / Kiran Kumari

Hibernate Session objects are not thread-safe because they maintain an open connection to the database. Multiple threads accessing a single session can lead to inconsistent data, as changes made by one thread may not be immediately visible to others. To avoid this, each thread should have its own Session object.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

Is orm faster than sql?

1 Answers  


What is meant by light object mapping?

1 Answers  


Hibernate SessionFactory is thread safe?

1 Answers  


What is the default cache in hibernate?

1 Answers  


What is lazy initialization in hibernate?

1 Answers  


What is id generator in hibernate?

1 Answers  


What is a hibernatetemplate?

1 Answers  


What is hibernate qbc api?

1 Answers  


What is <unk>onetomany mappedby?

1 Answers  


Mention two components of hibernate configuration object.

1 Answers  


How do you implement one to one relationship in hibernate with java annotation?

1 Answers  


Why jpa is better than hibernate?

1 Answers  


Categories