Why not Hibernate picks up the new record in the database?

There is an app database Manager with a web muzzle and app that pulls from this database record pulls. As ORM I use Hibernate. The bottom line: if in base to put the n-th number of records and then run the app, it will pull and handle. But if in the process of execution of the application (it is in a perpetual cycle spinning) to add a record to the database, then Hibernate refuses to pull it and returns an empty collection. It can be caused by?
July 9th 19 at 14:04
3 answers
July 9th 19 at 14:06
I suspect it's the caching. To reset the cache, use Session.clear()
I am also in the side watching, but no session.clear () or setting CacheMode effect was not given - nikita.Stracke commented on July 9th 19 at 14:09
July 9th 19 at 14:08
From the instructions:
session.getSessionFactory().getCache().evictQueryRegion( "query.cache.person" );

Treatment options are many, as you can see in the documentation.
did not help( - nikita.Stracke commented on July 9th 19 at 14:11
July 9th 19 at 14:10
Check how you completed the transaction after adding the records, you probably forgot to do a commit. Try to add a record and check for its presence by means of the database (SQL query), but not in your app.

Plus check the logic of the read data, work under the debugger (or add the messages output in the log) and verify that the application invokes a method of a reading periodically and not just at the start.

Find more questions by tags HibernateJava