Please submit patches here:
https://sourceforge.net/tracker/?func=add&group_id=22866&atid=376687

Thanks,

-- Juha

At 17:52 17.4.2001 +0200, you wrote:
>Hi!
>
>Problems occurred when using feature automatically creating
>findBy...-Methods with nested fields!
>JDBCFindByCommand-constructor could not recognize cmp-fields which are
>nested in data objects.
>
>Following small JDBCFindByCommand-constructor patch works fine:
>
>   public JDBCFindByCommand(JDBCCommandFactory factory, Method finderMethod)
>      throws IllegalArgumentException
>   {
>      super(factory, finderMethod.getName());
>      
>      String cmpFieldName =
finderMethod.getName().substring(6).toLowerCase();
>      Logger.debug("Finder:"+cmpFieldName);
>      
>      // Find the meta-info for the field we want to find by
>      
>      cmpField = null;
>      Iterator iter = jawsEntity.getCMPFields();
>      
>      while (cmpField == null && iter.hasNext())
>      {
>         CMPFieldMetaData fi = (CMPFieldMetaData)iter.next();
>
><patch>
>         // pay attention when working with nested fields
>                                // ergo, only compare lastComponent of fieldName
>                                // if there is no nested field, there should also be 
>no conflict by
comparing
>                                // it this way, because getLastComponent() returns the
>                                // parameter untouched
>                                if
(cmpFieldName.equals(CMPFieldMetaData.getLastComponent(fi.getName()).toLower
Case()))
>                                                cmpField = fi;
>      }
></patch>
>      
>      if (cmpField == null)
>      {
>         throw new IllegalArgumentException(
>            "No finder for this method: " + finderMethod.getName());
>      }
>      
>      // Compute SQL
>      
>      String sql = "SELECT " + getPkColumnList() +
>                   " FROM "+jawsEntity.getTableName()+ " WHERE ";
>      
>      sql += cmpField.getColumnName() + "=?";
>      
>      setSQL(sql);
>   }
>   
>Can this be added to repository because nested field support was
>also added and this would be a step to completion of nested field
>support (and I do not have to change it again if there will be - I
>hope there will be ;) - future releases of jBoss)
>
>Thanx
>
>-- 
>Torben Jäger
>Orientation in Objects GmbH
>http://www.oio.de
>
><< life is short - code hard >>
>
>
>_______________________________________________
>Jboss-development mailing list
>[EMAIL PROTECTED]
>http://lists.sourceforge.net/lists/listinfo/jboss-development
>

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to