I use JPA, with datasource configured in a persistence.xml file.

What is the exception that I must throw (Checked Exception) if the database name doesnt exist anymore after deploying the application or password wrong because it has been changed after deploying ( generally Database connection failure) ?

Because I don't succeed in catching it by the exception PersistenceException in my java project...

Thank you a lot.

有帮助吗?

解决方案

That must not be a checked exception, as I do not imagine any possible recovering mechanism from this situation. This is called (at least in the EJB spec) a system exception.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top