Hibernate - Update em massivo com createQuery().executeUpdate() e validar o resultado

Bom dia!

Estou com um problema, tenho uma série de updates massivos até ai sem problemas eles são executados.

Porém, após um update eu tenho que efetuar um select com criteria e este select com o criteria não me retorna os dados atualizados, segue exemplo:

// atualizo as informações para APPROVED
 session.createQuery("update EventTariff "
				+ "	set "
				+ "		approvalRemarks = :approvalRemarks, "
				+ " 	approvedDate = :approvedDate, "
				+ " 	approvedBy.id = :approvedBy, "
				+ " 	eventStatus = :eventStatus, "
				+ " 	updateUser = :updateUser, "
				+ " 	updateDate = :updateDate "
				+ " where id in (:ids) and "
				+ " eventStatus in (:pending) ")
				.setParameter("updateUser", user.getId())
				.setParameter("updateDate", now())
				.setParameter("approvedDate", now())
				.setParameter("approvalRemarks", approvalRemarks)
				.setParameter("approvedBy", user.getId())
				.setParameter("eventStatus", status)
				.setParameterList("ids", objs)
				.setParameterList("pending", asList(APPROVED, PARTIALLY_APPROVED, PENDING_APPROVAL, REFUSED))
				.executeUpdate();


Criteria criteria = session.createCriteria(EventTariff.class, "t");
			criteria.createAlias("event", "e")
					.add(eq("e.vessel", obj.getVessel()))
					.add(eq("e.voyage", obj.getVoyage()))
					.add(eq("e.direction", obj.getDirection()))
					.add(ilike("e.portOfLoad.name", obj.getPortOfLoad(), ANYWHERE))
					.add(eq("e.terminal.id", obj.getTerminalId()))
					.add(eq("e.costType.id", costType.getId()))
					.add(eq("e.movementType", obj.getMovementType()))
					.add(eq("e.brand", brand))
					.add(eq("e.service", obj.getService()))
					.add(in("t.eventStatus", new EventStatus[]{APPROVED, PARTIALLY_APPROVED, PENDING_APPROVAL}));	

Será que tenho usar o select no objeto?

Olá,

Provavelmente o Hibernate ainda não fez o commit ou o Hibernate está usando first level cache.
Tente forçar o commit e então fazer o select, mas lembre-se que após o commit não há como fazer o rollback se algo der erro mais a frente do código.

Abs

Olá então logo após o update fiz o flush, não posso dar commit pq tenho uma série de validações no criei vários blocos transacionais para esta solução

Eu faria assim então:

Persitir > Validou tudo > Persistiu > Commitou
Select > Consulta

ou seja

Em uma transaction vc faz o persistir, ela vai commitar e tals coisa linda, depois uma nova transaction fará o select. Duas chamadas.

Então eu só preciso dos IDs então fiz o seguinte:

session.createQuery(" select t.id from EventTariff t inner join t.event e where "
+ " e.vessel = :vessel "
+ " and e.voyage = :voyage "
+ " and e.direction = :direction "
+ " and e.terminal.id = :terminal "
+ " and e.costType.id = :costType "
+ " and e.movementType = :movementType "
+ " and e.brand = :brand "
+ " and e.service = :service "
+ " and t.eventStatus in (:statusList) "
)

e o select me volta com resultado esperado.

Obrigado!