EclipseLinkException [message #515675] |
Fri, 19 February 2010 12:53  |
Eclipse User |
|
|
|
EclipseLinkException is the root RuntimeException in the package org.eclipse.persistence.exceptions. This is similar to the manner of PersistenceException in the package javax.persistence. My question is why doesn't EclipseLinkException actually extend javax.persistence.PersistenceException?
In my application I programmed to JPA as specified in Java EE, but when I use the JPA implementation I don't get exceptions that adhere to the specification, they only mimic it. In theory, my application could swap JPA implementations and still work if my application only exposed itself to the Java EE specification.
Specifically, I'm catching the PersistenceException in my source, but the library is throwing EclipseLinkException, so I don't catch it and miss the opportunity to rollback my transaction. The fix is to step up one level and just catch java.lang.RuntimeException, but that adds more generality when I'm only dealing with persistence issues. Otherwise I can catch EclipseLinkException directly and lose some portability. The question isn't critical, but I am curious if someone has perspective on how API implementations map to the API specification.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04284 seconds