From 1a2d048f3df28611a51888d74599285664d3ed30 Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Fri, 4 Aug 2006 21:12:35 +0000 Subject: [PATCH] load-fetch-group annotation added git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@428883 13f79535-47bb-0310-9956-ffa450edef68 --- .../AnnotationPersistenceMetaDataParser.java | 5 +++ .../openjpa/persistence/LoadFetchGroup.java | 35 +++++++++++++++++++ .../openjpa/persistence/MetaDataTag.java | 1 + 3 files changed, 41 insertions(+) create mode 100644 openjpa-persistence/src/main/java/org/apache/openjpa/persistence/LoadFetchGroup.java diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java index cb85978ed..5e59f2eab 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java @@ -160,6 +160,7 @@ public class AnnotationPersistenceMetaDataParser _tags.put(Factory.class, FACTORY); _tags.put(FetchGroup.class, FETCH_GROUP); _tags.put(FetchGroups.class, FETCH_GROUPS); + _tags.put(LoadFetchGroup.class, LOAD_FETCH_GROUP); _tags.put(InverseLogical.class, INVERSE_LOGICAL); _tags.put(KeyDependent.class, KEY_DEPENDENT); _tags.put(KeyType.class, KEY_TYPE); @@ -1042,6 +1043,10 @@ public class AnnotationPersistenceMetaDataParser fmd.setTypeOverride(toOverrideType(((Type) anno). value())); break; + case LOAD_FETCH_GROUP: + if (isMetaDataMode()) + fmd.setLoadFetchGroup(((LoadFetchGroup)anno).value()); + break; default: throw new UnsupportedException(_loc.get("unsupported", fmd, anno.toString())); diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/LoadFetchGroup.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/LoadFetchGroup.java new file mode 100644 index 000000000..e125a46d1 --- /dev/null +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/LoadFetchGroup.java @@ -0,0 +1,35 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openjpa.persistence; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Fetch group loaded when the annotated field/property is loaded. + * + * @author Pinaki Poddar + * @since 4.0 + */ +@Target({ METHOD, FIELD }) +@Retention(RUNTIME) +public @interface LoadFetchGroup { + + String value(); +} diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java index 57aa339d8..2eaa53513 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MetaDataTag.java @@ -67,6 +67,7 @@ public enum MetaDataTag { FACTORY, FETCH_GROUP, FETCH_GROUPS, + LOAD_FETCH_GROUP, INVERSE_LOGICAL, KEY_DEPENDENT, KEY_TYPE,