private void initResultReader(JDBCEntityBridge2 entity, JDBCDeclaredQueryMetaData metadata) {
String entityName = metadata.getEJBName();
if (entityName != null) {
Catalog catalog = entity.getManager().getCatalog();
JDBCEntityBridge2 otherEntity = (JDBCEntityBridge2) catalog.getEntityByEJBName(entityName);
if (otherEntity == null) {
throw new RuntimeException("Unknown entity: " + entityName);
}
this.entity = otherEntity;
} else {