1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.queries; 23 24 import java.util.List ; 25 import java.util.ArrayList ; 26 27 import javax.persistence.ColumnResult; 28 import javax.persistence.EntityResult; 29 import javax.persistence.SqlResultSetMapping; 30 31 37 public class MetadataSQLResultSetMapping { 38 protected List <String > m_columnResults; 39 protected List <MetadataEntityResult> m_entityResults; 40 protected SqlResultSetMapping m_sqlResultSetMapping; 41 42 45 protected MetadataSQLResultSetMapping() {} 46 47 50 public MetadataSQLResultSetMapping(SqlResultSetMapping sqlResultSetMapping) { 51 m_sqlResultSetMapping = sqlResultSetMapping; 52 } 53 54 57 public List <MetadataEntityResult> getEntityResults() { 58 if (m_entityResults == null) { 59 m_entityResults = new ArrayList <MetadataEntityResult>(); 60 61 for (EntityResult entityResult : m_sqlResultSetMapping.entities()) { 62 m_entityResults.add(new MetadataEntityResult(entityResult)); 63 } 64 } 65 66 return m_entityResults; 67 } 68 69 72 public List <String > getColumnResults() { 73 if (m_columnResults == null) { 74 m_columnResults = new ArrayList <String >(); 75 76 for (ColumnResult columnResult : m_sqlResultSetMapping.columns()) { 77 m_columnResults.add(columnResult.name()); 78 } 79 } 80 81 return m_columnResults; 82 } 83 84 87 public String getName() { 88 return m_sqlResultSetMapping.name(); 89 } 90 } 91 | Popular Tags |