Package com.avaje.ebeaninternal.server.query

Examples of com.avaje.ebeaninternal.server.query.SqlTree


   * </p>
   */
  private SqlTree buildSqlTree(BeanDescriptor<?> desc){


    SqlTree sqlTree = new SqlTree();
    sqlTree.setSummary(desc.getName());

    LinkedHashSet<String> includedProps = new LinkedHashSet<String>();
    SqlTreeProperties selectProps = new SqlTreeProperties();

    for (int i = 0; i < selectColumns.length; i++) {

      DRawSqlColumnInfo columnInfo = selectColumns[i];
      String propName = columnInfo.getPropertyName();
      BeanProperty beanProperty = desc.getBeanProperty(propName);
      if (beanProperty != null) {
        if (beanProperty.isId()){
          if (i > 0){
            String m = "With "+desc+" query:"+name+" the ID is not the first column in the select. It must be...";
            throw new PersistenceException(m);
          } else {
            withId = true;
          }
        } else {
          includedProps.add(beanProperty.getName());
          selectProps.add(beanProperty);
        }
       
       
      } else {
        String m = "Mapping for " + desc.getFullName();
        m += " query["+name+"] column[" + columnInfo + "] index[" + i;
        m += "] not matched to bean property?";
        logger.error(m);
      }
    }

    SqlTreeNode sqlRoot = new SqlTreeNodeRoot(desc, selectProps, null, withId);
    sqlTree.setRootNode(sqlRoot);

    return sqlTree;
  }
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.server.query.SqlTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.