001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.jee.jpa;
017:
018: import java.util.ArrayList;
019: import java.util.List;
020: import javax.xml.bind.annotation.XmlAccessType;
021: import javax.xml.bind.annotation.XmlAccessorType;
022: import javax.xml.bind.annotation.XmlAttribute;
023: import javax.xml.bind.annotation.XmlElement;
024: import javax.xml.bind.annotation.XmlType;
025:
026: /**
027: *
028: *
029: * @Target({TYPE}) @Retention(RUNTIME)
030: * public @interface NamedNativeQuery {
031: * String name();
032: * String query();
033: * QueryHint[] hints() default {};
034: * Class resultClass() default void.class;
035: * String resultSetMapping() default ""; //named SqlResultSetMapping
036: * }
037: *
038: *
039: *
040: * <p>Java class for named-native-query complex type.
041: *
042: * <p>The following schema fragment specifies the expected content contained within this class.
043: *
044: * <pre>
045: * <complexType name="named-native-query">
046: * <complexContent>
047: * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
048: * <sequence>
049: * <element name="query" type="{http://www.w3.org/2001/XMLSchema}string"/>
050: * <element name="hint" type="{http://java.sun.com/xml/ns/persistence/orm}query-hint" maxOccurs="unbounded" minOccurs="0"/>
051: * </sequence>
052: * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
053: * <attribute name="result-class" type="{http://www.w3.org/2001/XMLSchema}string" />
054: * <attribute name="result-set-mapping" type="{http://www.w3.org/2001/XMLSchema}string" />
055: * </restriction>
056: * </complexContent>
057: * </complexType>
058: * </pre>
059: *
060: *
061: */
062: @XmlAccessorType(XmlAccessType.FIELD)
063: @XmlType(name="named-native-query",propOrder={"query","hint"})
064: public class NamedNativeQuery {
065:
066: @XmlElement(required=true)
067: protected String query;
068: protected List<QueryHint> hint;
069: @XmlAttribute(required=true)
070: protected String name;
071: @XmlAttribute(name="result-class")
072: protected String resultClass;
073: @XmlAttribute(name="result-set-mapping")
074: protected String resultSetMapping;
075:
076: /**
077: * Gets the value of the query property.
078: *
079: * @return
080: * possible object is
081: * {@link String }
082: *
083: */
084: public String getQuery() {
085: return query;
086: }
087:
088: /**
089: * Sets the value of the query property.
090: *
091: * @param value
092: * allowed object is
093: * {@link String }
094: *
095: */
096: public void setQuery(String value) {
097: this .query = value;
098: }
099:
100: /**
101: * Gets the value of the hint property.
102: *
103: * <p>
104: * This accessor method returns a reference to the live list,
105: * not a snapshot. Therefore any modification you make to the
106: * returned list will be present inside the JAXB object.
107: * This is why there is not a <CODE>set</CODE> method for the hint property.
108: *
109: * <p>
110: * For example, to add a new item, do as follows:
111: * <pre>
112: * getHint().add(newItem);
113: * </pre>
114: *
115: *
116: * <p>
117: * Objects of the following type(s) are allowed in the list
118: * {@link QueryHint }
119: *
120: *
121: */
122: public List<QueryHint> getHint() {
123: if (hint == null) {
124: hint = new ArrayList<QueryHint>();
125: }
126: return this .hint;
127: }
128:
129: /**
130: * Gets the value of the name property.
131: *
132: * @return
133: * possible object is
134: * {@link String }
135: *
136: */
137: public String getName() {
138: return name;
139: }
140:
141: /**
142: * Sets the value of the name property.
143: *
144: * @param value
145: * allowed object is
146: * {@link String }
147: *
148: */
149: public void setName(String value) {
150: this .name = value;
151: }
152:
153: /**
154: * Gets the value of the resultClass property.
155: *
156: * @return
157: * possible object is
158: * {@link String }
159: *
160: */
161: public String getResultClass() {
162: return resultClass;
163: }
164:
165: /**
166: * Sets the value of the resultClass property.
167: *
168: * @param value
169: * allowed object is
170: * {@link String }
171: *
172: */
173: public void setResultClass(String value) {
174: this .resultClass = value;
175: }
176:
177: /**
178: * Gets the value of the resultSetMapping property.
179: *
180: * @return
181: * possible object is
182: * {@link String }
183: *
184: */
185: public String getResultSetMapping() {
186: return resultSetMapping;
187: }
188:
189: /**
190: * Sets the value of the resultSetMapping property.
191: *
192: * @param value
193: * allowed object is
194: * {@link String }
195: *
196: */
197: public void setResultSetMapping(String value) {
198: this.resultSetMapping = value;
199: }
200:
201: }
|