Yes, I did think of that but I'm not sure its that straight-forward. I have a struts based web app and I am performing in-container unit testing. The particular struts action calls a delete method of my DAO, catches any exceptions, determines if it's a BatchUpdateException (BUE), and from the updateCounts I can determine which rows were not deleted, as the array of update counts is in the same order as the statements were executed, and therefore provide a useful error message.
To do as you suggest, I think I'd need to create a separate DAO that deliberately throws a BUE for test purposes only but that isn't testing my product code.
This test just involves setting some request parameters and invoking the actionPerform method of the struts action. I have control over the parameters for the sql statement, so it would be useful if I could do something with them to cause a BatchUpdateException.