private void readXmlRawSql(DeployBeanDescriptor<?> deployDesc, List<Dnode> entityXml) {
List<Dnode> rawSqlQueries = xmlConfig.find(entityXml, "raw-sql");
for (int i = 0; i < rawSqlQueries.size(); i++) {
Dnode rawSqlDnode = rawSqlQueries.get(i);
String name = rawSqlDnode.getAttribute("name");
if (isEmpty(name)) {
throw new IllegalStateException("raw-sql for " + deployDesc.getFullName() + " missing name attribute");
}
Dnode queryNode = rawSqlDnode.find("query");
if (queryNode == null) {
throw new IllegalStateException("raw-sql for " + deployDesc.getFullName() + " missing query element");
}
String sql = queryNode.getNodeContent();
if (isEmpty(sql)) {
throw new IllegalStateException("raw-sql for " + deployDesc.getFullName() + " has empty sql in the query element?");
}
List<Dnode> columnMappings = rawSqlDnode.findAll("columnMapping", 1);
RawSqlBuilder rawSqlBuilder = RawSqlBuilder.parse(sql);
for (int j = 0; j < columnMappings.size(); j++) {
Dnode cm = columnMappings.get(j);
String column = cm.getAttribute("column");
String property = cm.getAttribute("property");
rawSqlBuilder.columnMapping(column, property);
}
RawSql rawSql = rawSqlBuilder.create();
DeployNamedQuery namedQuery = new DeployNamedQuery(name, rawSql);