Morning all (EST):

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?
                
-- 
Nick Heudecker
System Mobile, Inc.
Email: [EMAIL PROTECTED]
Web: http://www.systemmobile.com


-------------------------------------------------------
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