Hi I think I have a newbie problem... I use Hibernate 1.0.2 1 year ago, It wors well, and I try now to use the 3.0 beta for some prototyping.
I just try to get a collection of "children" linked to a "parent".
If I try to load a Parent or a Child by using the primary key it works well, I only have problem to get all children from a specific parent.
When I put the debug mode for JDBC binding of Hibernate I see all records of children being read from the database... more than 200 record of children... So the mapping xml must be correct ? right? But when I am doing the parent.getChildren.getSize() I get 0 children! I dont understand why the children are not added to the Set of Children in the Parent class.
I check the HashCode method of the children value :
Code:
public int hashCode() {
int i = new HashCodeBuilder(17, 37).append(getUniqueId()).toHashCode();
return i;
}
and the debugger shows me that all hashCode were unique for all 200 records. All children should be add in the children Set of the parent classe?
Any idea?
Thanks for Answering
Etienne
Montreal
Hibernate version: 3.0 beta
Name and version of the database you are using: DB2 AS400
The generated SQL (show_sql=true):
select Childrens0_.trpgcd as trpgcd__, Childrens0_.trafnb as trafnb__, Childrens0_.trafnb as trafnb0_, Childrens0_.tregdc as tregdc5_0_, Childrens0_.trehdc as trehdc5_0_, Childrens0_.trpmcd as trpmcd5_0_, Childrens0_.trahqy as trahqy5_0_, Childrens0_.traiam as traiam5_0_, Childrens0_.trpncd as trpncd5_0_, Childrens0_.trg9cd as trg9cd5_0_, Childrens0_.trc1st as trc1st5_0_, Childrens0_.trpgcd as trpgcd5_0_ from childrenTable Childrens0_ where Childrens0_.trpgcd=?
20:23:15,716 DEBUG BigDecimalType:68 - returning 'Good_Child_ID' as column: trafnb0_
20:23:15,716 DEBUG StringType:68 - returning '20050103' as column: tregdc5_0_
20:23:15,716 DEBUG StringType:68 - returning '20050106' as column: trehdc5_0_
20:23:15,716 DEBUG StringType:68 - returning '12345 ' as column: trpmcd5_0_
20:23:15,716 DEBUG StringType:68 - returning '3080.000' as column: trahqy5_0_
20:23:15,716 DEBUG StringType:68 - returning '123.12' as column: traiam5_0_
20:23:15,716 DEBUG StringType:68 - returning 'ok' as column: trpncd5_0_
20:23:15,716 DEBUG StringType:68 - returning 'ok' as column: trg9cd5_0_
20:23:15,716 DEBUG StringType:68 - returning '...' as column: trc1st5_0_
20:23:15,716 DEBUG StringType:68 - returning 'good data ' as column: trpgcd5_0_
20:23:15,716 DEBUG StringType:68 - returning 'good data ' as column: trpgcd__
20:23:15,732 DEBUG BigDecimalType:68 - returning 'Good_Child_ID' as column: trafnb__
[...]