Is it ok to mix session.save and various HQL updates, which depend on

I have a function with a session argument that executes various HQL queries and HQL update instructions in sleep mode. They create sql that goes against many tables. All in one transaction.

Now what I want to do is add one entity that this function depends on in another function, with session.save, and then calls the first function. I am worried that Hiberante will not invoke the SQL associated with session.save (myentity) before executing HQL queries and updates, which depend on the former. Some sort of caching in the session and reordering of claims.

Andy

+3
source share
1

, Hibernate SQL, session.save(myentity), HQL, .

, :

10.10.

SQL, JDBC , . , flush, :

  • from org.hibernate.Transaction.commit()
  • Session.flush()

SQL :

  • Session.save()
  • ,
  • , Session.delete()

, , , .

, flush(), , JDBC , . , Hibernate , Query.list(..) .

, , , : . , ( ). , ?

+3

Source: https://habr.com/ru/post/1757763/


All Articles