1 21 package oracle.toplink.essentials.internal.ejb.cmp3.xml.queries; 23 24 import java.util.List ; 25 import java.util.ArrayList ; 26 27 import org.w3c.dom.Node ; 28 import org.w3c.dom.NodeList ; 29 30 import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLHelper; 31 import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLConstants; 32 33 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.queries.MetadataQueryHint; 34 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.queries.MetadataNamedNativeQuery; 35 36 42 public class XMLNamedNativeQuery extends MetadataNamedNativeQuery { 43 protected Node m_node; 44 protected XMLHelper m_helper; 45 46 49 public XMLNamedNativeQuery(Node node, XMLHelper helper) { 50 m_node = node; 51 m_helper = helper; 52 } 53 54 57 public String getEJBQLString() { 58 return m_helper.getNodeTextValue(m_node, XMLConstants.QUERY); 59 } 60 61 64 public List <MetadataQueryHint> getHints() { 65 if (m_hints == null) { 66 m_hints = new ArrayList <MetadataQueryHint>(); 67 68 NodeList hints = m_helper.getNodes(m_node, XMLConstants.QUERY_HINT); 69 70 if (hints != null) { 71 for (int i = 0; i < hints.getLength(); i++) { 72 m_hints.add(new XMLQueryHint(hints.item(i), m_helper)); 73 } 74 } 75 } 76 77 return m_hints; 78 } 79 80 83 public String getName() { 84 return m_helper.getNodeValue(m_node, XMLConstants.ATT_NAME); 85 } 86 87 90 public Class getResultClass() { 91 return m_helper.getNodeValue(m_node, XMLConstants.ATT_RESULT_CLASS, void.class); 92 } 93 94 97 public String getResultSetMapping() { 98 return m_helper.getNodeValue(m_node, XMLConstants.ATT_RESULT_SET_MAPPING, ""); 99 } 100 101 104 public boolean loadedFromAnnotations() { 105 return false; 106 } 107 108 111 public boolean loadedFromXML() { 112 return true; 113 } 114 } 115 | Popular Tags |