Hi, I have read chapter about using EntityManager in 'EJB 3.0 in Action' and I have some doubts about one thing. The authors wrote, that a way of getting the latest data from DB is to use refresh function (Refresh the state of the instance from the database, overwriting changes made to the entity, if any.). The parameter of this function is an object, which should be already attached to the EntityManager (EM), so we could write it like this:
Earlier the authors have already wrote, that functions connected to EM (like persist, merge and so on), don't have to be done right away, they will be done later or soner, but we can't be shure when (of course before transaction commit) - it's becaouse FlashMode is set to 'Auto'. So me questions is simple. Is it possible, that in
the 'inside' part of the function (entityManager.merge(item)), will be executed by the entitymanager so that it will send to DB some kind of new data connected with this entity (it will be flushed), and later the 'refresh' method will get this new data (which will be already in DB).
And, if no, what about this code:
I hope my questions is quite clear (if not sorry). Thanks a lot for the answers.