}
}
// process queries
for (Query query : bean.getQuery()) {
NamedQuery namedQuery = new NamedQuery();
QueryMethod queryMethod = query.getQueryMethod();
// todo deployment id could change in one of the later conversions... use entity name instead, but we need to save it off
StringBuilder name = new StringBuilder();
name.append(entityName).append(".").append(queryMethod.getMethodName());
if (queryMethod.getMethodParams() != null && !queryMethod.getMethodParams().getMethodParam().isEmpty()) {
name.append('(');
boolean first = true;
for (String methodParam : queryMethod.getMethodParams().getMethodParam()) {
if (!first) name.append(",");
name.append(methodParam);
first = false;
}
name.append(')');
}
namedQuery.setName(name.toString());
namedQuery.setQuery(query.getEjbQl());
entity.getNamedQuery().add(namedQuery);
}
// todo: there should be a common interface between ejb query object and openejb query object
EjbDeployment ejbDeployment = openejbJar.getDeploymentsByEjbName().get(bean.getEjbName());
if (ejbDeployment != null) {
for (org.apache.openejb.jee.oejb3.Query query : ejbDeployment.getQuery()) {
NamedQuery namedQuery = new NamedQuery();
org.apache.openejb.jee.oejb3.QueryMethod queryMethod = query.getQueryMethod();
// todo deployment id could change in one of the later conversions... use entity name instead, but we need to save it off
StringBuilder name = new StringBuilder();
name.append(entityName).append(".").append(queryMethod.getMethodName());
if (queryMethod.getMethodParams() != null && !queryMethod.getMethodParams().getMethodParam().isEmpty()) {
name.append('(');
boolean first = true;
for (String methodParam : queryMethod.getMethodParams().getMethodParam()) {
if (!first) name.append(",");
name.append(methodParam);
first = false;
}
name.append(')');
}
namedQuery.setName(name.toString());
namedQuery.setQuery(query.getObjectQl());
entity.getNamedQuery().add(namedQuery);
}
}
}
entityMappings.getMappedSuperclass().addAll(mappedSuperclassByClass.values());