Can we create two sessionfactory in hibernate?



Can we create two sessionfactory in hibernate?..

Answer / Sarvesh Kumar

No, it is not recommended to have multiple SessionFactory instances for a single Hibernate application because they are thread-unsafe and expensive to create. Instead, use Configuration.configure() method to configure one and obtain the SessionFactory instance using Configuration.buildSessionFactory(ServiceRegistry serviceRegistry).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

What is the difference between session.save() and session.persist() method?

1 Answers  


What is indexing in hibernate?

1 Answers  


What is lazy initialization in hibernate?

1 Answers  


What is the difference between update and upgrade?

1 Answers  


Why do we need hql?

1 Answers  


What is detached object in hibernate?

1 Answers  


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

1 Answers  


What is fetchtype lazy in hibernate?

1 Answers  


What is meant by full object mapping?

1 Answers  


What are the annotations used in hibernate?

1 Answers  


What is the difference between get and load method?

1 Answers  


What is the difference between load() and get() method in hibernate?

1 Answers  


Categories