diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-04-07 17:14:17 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-04-07 17:35:48 +0400 |
commit | aa5de1d8e7f8f6d68f9be98ad9536e4f6db88b6f (patch) | |
tree | 1079ebde7ff69936a8138dce7cecac30dd72fcb2 /sonar-core | |
parent | 3fa574c4b6a111a8c7fa830b0cefb7a27ae9e681 (diff) | |
download | sonarqube-aa5de1d8e7f8f6d68f9be98ad9536e4f6db88b6f.tar.gz sonarqube-aa5de1d8e7f8f6d68f9be98ad9536e4f6db88b6f.zip |
SONAR-2234 JpaDatabaseSession: improve exception message for persist operations
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java b/sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java index 6c87056f278..12c0f7c7a88 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java +++ b/sonar-core/src/main/java/org/sonar/jpa/session/JpaDatabaseSession.java @@ -109,7 +109,15 @@ public class JpaDatabaseSession extends DatabaseSession { } private void internalSave(Object model, boolean flushIfNeeded) { - entityManager.persist(model); + try { + entityManager.persist(model); + } catch (PersistenceException e) { + /* + * See http://jira.codehaus.org/browse/SONAR-2234 + * In some cases Hibernate can throw exceptions without meaningful information about context, so we improve them here. + */ + throw new PersistenceException("Unable to persist : " + model, e); + } if (flushIfNeeded && (++index % BATCH_SIZE == 0)) { commit(); } |