Added flushing to make sure query finds the newly persisted object.