Please submit this to JIRA, so that it doesn't get lost...

Thanks,
Gavin

Nick Heudecker wrote:

Sorry for the resend, but were there any thoughts on this, or should I request an enhancement through JIRA?


I would like to make the setProperties(Object) method in the Query class a bit smarter by adding a patch looking something like this:

public Query setProperties(Object bean) throws HibernateException {
   Class clazz = bean.getClass();
   String[] params = getNamedParameters();
   for (int i = 0; i < params.length; i++) {
       String namedParam = params[i];
       try {
            Getter getter = ReflectHelper.getter(clazz, namedParam);
            Class retType = getter.getReturnType();
                           if (retType.isArray() || retType instanceof 
java.util.Collection) {
                setParameterList( namedParam, getter.get(bean) );
                   }
                   else {
                       setParameter( namedParam, getter.get(bean), guessType( 
getter.getReturnType() ) );
                           }
              }
              catch (PropertyNotFoundException pnfe) {
                          // shouldn't something be logged here....?
       }
          }
          return this;
}

Thoughts on this?



-- Gavin King JBoss Group +61 410534454 http://hibernate.org



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to