By default, Hibernate flushes the pending changes before executing a query, to make sure that the query sees the changes that you've made before executing this query. If it didn't you could have this frustrating situation:
Foo foo = (Foo) session.get(Foo.class, 1L);
foo.setColor("red");
List<Foo> redFoos =
session.createQuery("select foo from Foo foo where foo.color = 'red'");
if (redFoos.isEmpty()) {
System.out.println("WTF?");
}