title: What exceptions are thrown by JPA in ejb containers?
body: <p>I am developing an EJB application to run on glassfish v3. If I look at the javadoc for the EntityManager class it says that methods like find, persist etc throw exceptions derived from PersistenceException. However, in practice I notice that exceptions derived from org.eclipse.persistence.exceptions.DatabaseException can be thrown if something goes wrong at the database level (a table can't be found for example). So am right in assuming that in addition to the standard persistence exceptions, I also have to handle exceptions thrown by whichever persistence provider I am using? That would tend to imply that I need to write error code specific to the JPA provider I choose and if I change to a different one later I need to change my code to catch a different exception class such as HibernateException.</p>