Why double casting?

Hi I was studying the Hibernate Implementation from it’s source code and found that if its normal script like below

select * from A where a.id = ?

in that case when Hibernate converts data from result set then it creates first Object array from result set then initializes the Id of bean,

post that somewhere it goes and hydrates the rest of the properties of bean/pojo, now here i sight performance issue because we are end up actually iterating twiceon same data set

  1. when created Object array to result set
  2. when hydrating object of persistence entity from that Object array

why can’t hibernate just directly populates the persistence object instead of twice iterating on same data set

Please clarify if I am wrong it possible I have seen only specific part of codes since entire code base inspection is not possible in short span.

can help me to understand it’s working or any reference from where I can get proper working and which method is being used where from which class?

@vlad Hey vlad or anyone from Hibernate Support Can help me out on above query.