Hibernate version : 2.1rc1
Database : MSSQL Server 2000
Problem:
Parent/child association: I use Creatia, Example class to query, insert data.
1. Hibernate generate query sql using left outer join. But when I use Oracle, query sql using inner join. Is it right action in hibernate? How to know what kind of join(left outer join/inner join) will be used when I use Creatia and Example to query data? Can I specify a right join way?
2. When I query data from parent table, I found the result different between Oracle and SQL Server.
e.g.
Code:
Parent table
id name
Child table
id parent_id
My query code is like this:
Code:
Criteria crit = session.createCriteria(ParentModel.class);
crit.add(Example.create(parentModel));
crit.list();
Data in table:
Code:
Parent table:
id = 1, name = "55"
Child table:
id = 1, parent_id = 1
id = 2, parent_id = 1
If database is Oracle, the result will be one ParentModel instance and instance has a set of children with two child.
If database is MSSQL, the result will be two ParentModel instances and both instances have a set of children with two child.
So I am very strange. Is is a bug in version 2.1rc1?
And I also found problem on inserting data into parent table with a set of children. Detail description is here:
http://forum.hibernate.org/viewtopic.php?p=2191785#2191785
Can somebody help me?