diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java index 265fbb2e0..7a9b3b8d1 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java @@ -4160,6 +4160,12 @@ public class BrokerImpl } catch (Throwable t) { } } + + if (_conf.getMetaDataRepositoryInstance().getMetaData(cls, + getClassLoader(), false) == null) + throw new IllegalArgumentException( + _loc.get("no-interface-metadata", cls.getName()).getMessage()); + try { return PCRegistry.newInstance(cls, null, false); } catch (IllegalStateException ise) { diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java index 5a7a5eba0..507431219 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java @@ -269,7 +269,7 @@ public abstract class AbstractMetaDataDefaults * Returns ACCESS_FIELD by default. */ protected int getAccessType(ClassMetaData meta) { - return ClassMetaData.ACCESS_FIELD; + return ClassMetaData.ACCESS_FIELD; } /** 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 43c097b8d..2753e7ce6 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 @@ -737,6 +737,9 @@ public class ClassMetaData // the implementations. if (isManagedInterface()) setIntercepting(true); + + // managed interfaces always use property access. + setAccessType(ACCESS_PROPERTY); } /** diff --git a/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties b/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties index 55970dfc0..cfeac3d4f 100644 --- a/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties +++ b/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties @@ -396,3 +396,4 @@ cant-serialize-pessimistic-broker: Serialization not allowed for brokers with \ an active datastore (pessimistic) transaction. cant-serialize-connected-broker: Serialization not allowed for brokers with \ an active connection to the database. +no-interface-metadata: No metadata was found for managed interface {0}. \ No newline at end of file