ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leandro Saad" <leandro.s...@gmail.com>
Subject Re: Usage of Reflection
Date Tue, 25 Jul 2006 12:31:58 GMT
I would not be concerned about reflection speed issues since sun has put a
lot of effort to make it more fast. Most of the ORM tools I know (not only
in Java) use reflection to populate beans from the result set, so reflection
is not something you can avoid using these tools.

You could write a simple test to compare calling your setters and using
reflection. Do you know the beanutils package?

This is what I have in my mind.
//TODO: track time
Map values = new HashMap();
for(int i=0 ; i< 1000000 ; i++)
  Bean bean = new Bean();
//TODO: track time
for(int i=0 ; i< 1000000 ; i++)
  Bean bean = new Bean();
//TODO: track time

This should give you an idea o reflection speed.
Leandro Rodrigo Saad Cruz
CTO - InterBusiness Technologies

On 7/25/06, Sumanta Ghosh <sumanta.g@tcs.com> wrote:
> Hi,
>    We have started a new project where I have proposed IBATIS. But since
> IBATIS uses reflection to populate result or parameters, people are
> raising
> concerns. Now we have decided to go with either of the 2 options: -
>          1. Using Maps for result and parameters and then populating the
> Entities from Maps (e.g. Entities will have a setAttributes(Map attrs)
> method where a Entity will set its attributes from the Map) - but here the
> concern is slowness of Map and also more coding, as in each Entity we have
> to implement setAttributes(Map attrs) method.
>          2. Using Entities as result and parameters - but here concern is
> usage of reflection.
>       Which option to go with?  Please advice.
> --
> View this message in context:
> http://www.nabble.com/Usage-of-Reflection-tf1996304.html#a5479650
> Sent from the iBATIS - User - Java forum at Nabble.com.

View raw message