这是情景:
- Session 1 inserts a new object into the DB
- Session 2 immediately queries the new object from the DB using a HQL query
-> first call to Query.list() (or Query.uniqueResult()) returns null
-> second immediate call to Query.list() returns the new object
这是时间问题吗?在会话1“准备好”之前,我是否必须“等待”?这是一个缓存问题吗?
使用: MS SQL Server 2014,Hibernate 4.1.1.Final
也许,相关设置: hibernate.connection.isolation = 4096