Community
Participate
Working Groups
Build Identifier: 2.3.2 Just noticed that when I forgot to add a field to my database, EclipseLink throws some eclipselink-proprietry DatabaseException instead of a JPA-compliant PersistenceException. The problem is that a the application software is vendor-agnostic, so it dies not expect that it has to catch eclipse-link proprietary exceptions. It solely catches PersistenceException. As a result, the JVM stops as DatabaseException extends RuntimeException. This is nasty behaviour. Obviously the problem should be catchable, so EclipseLink should throw a JPA-compliant exception instead. Reproducible: Always Steps to Reproduce: Write an application that does not know anything about EclipseLink but solely uses vanilla JPA. The application shall access a database in a try-catch(PersistenceException) block but not catch RuntimeException. Remove a database field that the application tries to read or write. Run the application. The JVM will stop due to RuntimeException (i. e. DatabaseException).
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next.
Created attachment 227997 [details] wraps RuntimeExceptions in PersistenceExceptions
This fix causes JPA query methods getResultList, getSingleResult, execute, executeUpdate and EclipseLink's getResultCollection to wrap RuntimeExceptions in PersistenceExceptions and mark the transaction for rollback. It includes a few test changes where EclipseLInk native exceptions were expected to be thrown that now receive PersistenceException instances wrapping the underlying cause. This fixes most instances I could find. Please file new bugs if additional methods are found to be still throwing native EclipseLink exceptions incorrectly. Checked into Main (2.5) via SHA-1: 72354843858c801bfa11aa5e5cfd0c191b0e8242
Created attachment 228143 [details] additional patch
Changes have been checked into 2.3.4 and 2.4.3 as well.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink