简体   繁体   中英

Is the resorting of Insert, Update and Delete Statements a JPA standard, or only Hiberate specific?

Hibernate sort the statements that are executed when flush is invoked in that order: All Inserts, all Updates all deletes (see below for the exact definition).

What I want to know is, is this behaviour a standard behaviour required by JPA and do Eclipselink the same, or is this just a Hibernate Feature?


Hibernate Reference, Chapter 11.10. Flushing the Session

The SQL statements are issued in the following order:

  1. all entity insertions in the same order the corresponding objects were saved using Session.save()
  2. all entity updates
  3. all collection deletions
  4. all collection element deletions, updates and insertions
  5. all collection insertions
  6. all entity deletions in the same order the corresponding objects were deleted using Session.delete()

Any JPA implementation can do what it needs in terms of flush ordering; the spec does not define such things, solely that all data makes its way into the datastore. Not all implementations will order them as Hibernate does. Some (eg DataNucleus JPA ) do it based on pure referential integrity requirements in terms of what needs to be there first

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM