private boolean isDeadlockError(Throwable e)
	{
		// Looking for PersistenceException, wrapping a LockAcquisitionException
		if (e != null && e instanceof PersistenceException)
		{
			e = e.getCause();

			if (e != null && e instanceof LockAcquisitionException)
			{
				return true;
			}
		}

		// Does not match
		return false;
	}
private boolean isDeadlockError ( Throwable e ) { if ( e != null && e instanceof PersistenceException ) { e = e . getCause ( ) ; if ( e != null && e instanceof LockAcquisitionException ) { return true ; } } return false ; }
Special-case for SQL Server deadlock errors, that look like:
<pre>2017-12-01 07:49:48,504 ERROR Transaction (Process ID 55) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
2017-12-01 07:49:48,539 ERROR z9ti8f0eai POST /automation/work-orders threw exception:
javax.persistence.PersistenceException: org.hibernate.exception.LockAcquisitionException: could not execute query
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:149)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1423)
at org.hibernate.query.Query.getResultList(Query.java:146)
at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:72)
at com.peterphi.std.guice.hibernate.webquery.impl.jpa.JPAQueryBuilder.selectEntity(JPAQueryBuilder.java:512)
at com.peterphi.std.guice.hibernate.webquery.impl.jpa.JPASearchExecutor.find(JPASearchExecutor.java:118)
at com.peterphi.std.guice.hibernate.dao.HibernateDao.find(HibernateDao.java:552)
at com.peterphi.std.guice.hibernate.module.TransactionMethodInterceptor.invoke(TransactionMethodInterceptor.java:84)
at com.peterphi.std.guice.hibernate.dao.HibernateDao.find(HibernateDao.java:532)
at com.peterphi.std.guice.hibernate.dao.HibernateDao.find(HibernateDao.java:525)
at com.peterphi.std.guice.hibernate.dao.HibernateDao.findByUriQuery(HibernateDao.java:518)
...
at com.peterphi.std.guice.hibernate.module.TransactionMethodInterceptor.createTransactionAndExecuteMethod(TransactionMethodInterceptor.java:164)
at com.peterphi.std.guice.hibernate.module.TransactionMethodInterceptor.invoke(TransactionMethodInterceptor.java:105)
...
Caused by: org.hibernate.exception.LockAcquisitionException: could not execute query
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
at org.hibernate.loader.Loader.doList(Loader.java:2705)
at org.hibernate.loader.Loader.doList(Loader.java:2685)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2517)
at org.hibernate.loader.Loader.list(Loader.java:2512)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:384)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1490)
at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1445)
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1414)
... 44 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Transaction (Process ID 55) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet$FetchBuffer.nextRow(SQLServerResultSet.java:6357)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLServerResultSet.java:1798)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultSet.java:1049)
at org.hibernate.loader.Loader.processResultSet(Loader.java:997)
at org.hibernate.loader.Loader.doQuery(Loader.java:959)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:351)
at org.hibernate.loader.Loader.doList(Loader.java:2702)
... 53 more</pre>

@param e

@return