From c28c7830d52599fffb271c51e96fd414ca929645 Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Mon, 1 Dec 2008 12:42:00 +0000 Subject: [PATCH] More informative message when multiple fields used wrongly as primary key git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@722060 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/openjpa/meta/ClassMetaData.java | 3 ++- .../resources/org/apache/openjpa/meta/localizer.properties | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java index a8ae0cbc1..c34098a7b 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java @@ -1861,7 +1861,8 @@ public class ClassMetaData throw new MetaDataException(_loc.get("unsupported-id-type", _type, pks[0].getName(), pks[0].getDeclaredType().getName())); - throw new MetaDataException(_loc.get("no-id-class", _type)); + throw new MetaDataException(_loc.get("no-id-class", _type, + Arrays.asList(toNames(pks)))); } if (_objectId == null) return; diff --git a/openjpa-kernel/src/main/resources/org/apache/openjpa/meta/localizer.properties b/openjpa-kernel/src/main/resources/org/apache/openjpa/meta/localizer.properties index a38adc9dc..1a1914ed6 100644 --- a/openjpa-kernel/src/main/resources/org/apache/openjpa/meta/localizer.properties +++ b/openjpa-kernel/src/main/resources/org/apache/openjpa/meta/localizer.properties @@ -164,9 +164,9 @@ id-types: Type "{0}" does not declare the same identity-type as its persistent \ superclass. id-classes: Type "{0}" declares an id class "{1}" that does not match or \ extend its persistent superclass "{2}" identity class "{3}". -no-id-class: Type "{0}" with application identity and no superclass does \ - not declare an id class. This type is not eligible for builtin \ - identity, so it must declare an id class. +no-id-class: Entity "{0}" is using composite primary key comprising more than \ + one fields "{1}", but no primary key class has been defined in this class \ + or any of its persistent super classes. bad-pk: Field "{0}" cannot be a primary key. Primary key fields can only be \ declared in base persistent classes that also declare their identity-type \ to be "application".