Search code examples
mysqlhibernatedistributed-cachingsessionfactorydatabase-engine

Issue with Multiple/Distributed hibernate SessionFactory instances with MySQL


I am having an issue while accessing single database instance using multiple/distributed Hibernate SessionFactories i.e. multiple instances of Hibernate SessionFactory. If I use one session factory to perform insert operation and create new SessionFactory to retrieve data from database without closing the former SessionFactory then I get "null". I have also tried to use multiple Second Level Cache Platforms but none resolved issues. Do reply if anyone have found any solution to this.

I am using MySql database and my the database engine chosen at installation time is Innodb. Thanks.


Solution

  • After working over the issue and trying everything which could be done with hibernate I found no solutions to the issue. Then after I tried changing the database engine to MYISAM from the earlier Innodb which resolved issues of data not getting fetched and throwing NullPointerException.

    I would like to know if somebody can tell why MYISAM worked and Innodb failed to work in distributed operations for insert followed by retrieval ?