简体   繁体   中英

When using JPA2 EntityListener, how does it work if i use the in clause to update multiple rows?

query: update Order set f='1' where key in (1,2,3,4,5)

@PostUpdate
public void postUpdate(Order order) {
    ....     
}

I wonder what happens if I work as above.

If you execute a bulk update/jpql update query of the from "update Order set f='1' where key in (1,2,3,4,5)" you get those rows affected and nothing else. JPQL bulk updates/deletes run in the database, so they do not affect your java entities and do not cause entity lifecycle events to occur.

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