No, this is expected behavior. Writing to the database is asynchronous. From the moment you call .persist
until that is processed by the persistence service (which is done by calling Item.getState
) it takes a small amount of time. If you immediately post a new value, then chances are high this gets persisted.
What exactly are you trying to achieve?