Suppose we want to do bulk Operation how we can do it ?
If we do this way then we are doing it one by one and 3 delete sql get executed. It is not deleting all at once. What if i don't want it like this we want to bulk delete. as you know bulk operation run faster.
We can do by writing a JPQL query along with annotation with @Modifiying
Why the bulk operation is faster because it doesn't load the data in persistenceContext as it get loaded in the above case when we do one by one or by derived query. Its not deleting from persistenceContext it directly get deleted from data base thats why its faster operation and it also not take memory in JVM. As well as no call back method also get triggered here. When in the above case it get triggered.
Comments
Post a Comment