This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Well deadlocks are expected behaviour now and again in a relational database, which is why databases have recovery mechanisms. If it happens all the time (in a repeatable way) you have an issue in your stored procedure which you will need to address. If it happens fequently in an unrepeatable way you possibly have an issue with your data model (typically a poorly normalized data model), or your transaction times may be too long. It it happens only very occasionally you can code round it - catch the SQLException, check the error code == deadlock and retry the database operation.