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 NamedQuery {
031: * String name();
032: * String query();
033: * QueryHint[] hints() default {};
034: * }
035: *
036: *
037: *
038: * <p>Java class for named-query complex type.
039: *
040: * <p>The following schema fragment specifies the expected content contained within this class.
041: *
042: * <pre>
043: * <complexType name="named-query">
044: * <complexContent>
045: * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
046: * <sequence>
047: * <element name="query" type="{http://www.w3.org/2001/XMLSchema}string"/>
048: * <element name="hint" type="{http://java.sun.com/xml/ns/persistence/orm}query-hint" maxOccurs="unbounded" minOccurs="0"/>
049: * </sequence>
050: * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
051: * </restriction>
052: * </complexContent>
053: * </complexType>
054: * </pre>
055: *
056: *
057: */
058: @XmlAccessorType(XmlAccessType.FIELD)
059: @XmlType(name="named-query",propOrder={"query","hint"})
060: public class NamedQuery {
061:
062: @XmlElement(required=true)
063: protected String query;
064: protected List<QueryHint> hint;
065: @XmlAttribute(required=true)
066: protected String name;
067:
068: /**
069: * Gets the value of the query property.
070: *
071: * @return
072: * possible object is
073: * {@link String }
074: *
075: */
076: public String getQuery() {
077: return query;
078: }
079:
080: /**
081: * Sets the value of the query property.
082: *
083: * @param value
084: * allowed object is
085: * {@link String }
086: *
087: */
088: public void setQuery(String value) {
089: this .query = value;
090: }
091:
092: /**
093: * Gets the value of the hint property.
094: *
095: * <p>
096: * This accessor method returns a reference to the live list,
097: * not a snapshot. Therefore any modification you make to the
098: * returned list will be present inside the JAXB object.
099: * This is why there is not a <CODE>set</CODE> method for the hint property.
100: *
101: * <p>
102: * For example, to add a new item, do as follows:
103: * <pre>
104: * getHint().add(newItem);
105: * </pre>
106: *
107: *
108: * <p>
109: * Objects of the following type(s) are allowed in the list
110: * {@link QueryHint }
111: *
112: *
113: */
114: public List<QueryHint> getHint() {
115: if (hint == null) {
116: hint = new ArrayList<QueryHint>();
117: }
118: return this .hint;
119: }
120:
121: /**
122: * Gets the value of the name property.
123: *
124: * @return
125: * possible object is
126: * {@link String }
127: *
128: */
129: public String getName() {
130: return name;
131: }
132:
133: /**
134: * Sets the value of the name property.
135: *
136: * @param value
137: * allowed object is
138: * {@link String }
139: *
140: */
141: public void setName(String value) {
142: this.name = value;
143: }
144:
145: }
|