i am following struts 2 and hibernate 5. I have two tables A and B with different primary keys A_ID and B_ID. They have common columns like model, name.
In my hbm file, I didnt refer to any of the above tables instead I have a subselect query which joins the two tables.
The mappings in the hbm file is
<id name="a_id" column="A_ID" />
<property name="b_model" column="B_model"/>
When i ran the hibernate query generated. I got the following output in MySql
A_Id B_model other columns
But the list returned when the query is executed is
list(0) = 111 and 3131
list(1) = 222 and 2121
list(2) = 222 and **2121**
list(3) = 333 and 5151.
My question is why didnt list(2) didnt have 4141 instead of 2121.
And please let me know what i should to get the same (i.e) i need 4141 in list(2).
I probably guess it is creating one object for the primary key tuple 222 and setting it to the first value 2121. And hence the next value which is also 222 contains the first value 2121. Please confirm this and a possible solution to my problem.