'Do hibernate interceptors run is separate thread
I am using hibernate in the backend in my webapplication, now I want to use hibernate interceptors to do custom action logging but I fear that if the interceptors execute in the same thread there will be delays on the client..
I wanted to know if hibernate interceptors run in same thread or different thread?
any comments are helpful..
thanks in advance.
Solution 1:[1]
Yes, Interceptors which execute on hibernate event listeners , post an update or insert are on same thread.
@Override
public void onPostUpdate(
PostUpdateEvent event) {
final Object entity = event.getEntity();
if(entity instanceof YourEntity) {
}
}
Here i have printThread Id and put debug breakpoint , its the same running thread. In fact you put break point in event interceptors your return(method from which hibernate event is called) will not get executed until you run over the break point.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | yash |


