Hi Tom,
Thanks for the quick reply. OK for the explanation, and I don't mind implementing the retry logic for this case... I just don't know how to detect when my code encounters this case (as opposed to other cases that can arise, such as unresolved foreign keys when importing data; I don't want to get into an infinite retry loop because it will never work in these other cases).
For example, are there some specific values I can query for using SQLException.getErrorCode() or SQLException.getSQLState(), or perhaps I can check to see if the SQLException is an instance of a specific subclass? I don't know where to start, because trial and error isn't an option: I'm unable to cause the same errors locally that I'm sometimes seeing on a live server.