Thanks for replies :)
I'm using postgres. Tried getting the transaction level set to READ_UNCOMMITTED but can't get it working ( Task for another day ) but that explains why I don't see the changes with my sql tool until the commit.
However, here is another closely related issue i'm seeing.
Does refresh() do a dirty read from the database? I would have thought it should pull back the last persisted state of my object, and not the state that the last flush() left it in?
Code:
Session session = HibernateUtil.beginTransaction();
User user1 = (User)session.get(User.class, new Long("7") );
user1.setEmailAddress("Old");
session.getTransaction().commit();
session = HibernateUtil.beginTransaction();
User user = (User)session.get(User.class, new Long("7") );
user.setEmailAddress("New");
session.flush();
session.refresh(user);
//User still has email set to "New", does this mean that refresh() is doing a "Dirty" read from the database ?
session.getTransaction().commit();