-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Reading through the JPA documentation, I don't think we're providing the right guidance in terms of how to execute blocking database calls. It should be very clear that you usually do not want to execute blocking calls in the default execution context.
Also, It seems to me that the @Transactional annotation is broken, since you end up running blocking database calls on Play's default execution context, and we strongly suggest that as the way to do it. We could fix this, but the execution context needs to come from somewhere: either Play needs to be responsible for creating it or the user needs to bind it.
If we decide to require a separate execution context, we could also provide an async JPA API, where methods like withTransaction should return CompletionStage<T> and automatically run the transaction in a separate execution context.