JPA EntityManagerFactoryUtils silently ignores IllegalArgumentExceptions from setHint calls (SPR-7947)
This commit is contained in:
parent
e6272312a8
commit
2cb287a01b
|
|
@ -263,8 +263,18 @@ public abstract class EntityManagerFactoryUtils {
|
|||
EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource(emf);
|
||||
if (emHolder != null && emHolder.hasTimeout()) {
|
||||
int timeoutValue = (int) emHolder.getTimeToLiveInMillis();
|
||||
query.setHint("javax.persistence.lock.timeout", timeoutValue);
|
||||
query.setHint("javax.persistence.query.timeout", timeoutValue);
|
||||
try {
|
||||
query.setHint("javax.persistence.lock.timeout", timeoutValue);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// oh well, at least we tried...
|
||||
}
|
||||
try {
|
||||
query.setHint("javax.persistence.query.timeout", timeoutValue);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// once again, at least we tried...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue