From: Ingo J. (JIRA) <no...@at...> - 2006-06-10 18:47:32
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1283?pa= ge=3Dcomments#action_23307 ]=20 Ingo Jobling commented on HHH-1283: ----------------------------------- I am also confirming this bug. Until this is fixed, I modified my HQL by r= emoving the fetch join on "one to many" collection (resulting in n+1 select= s). This seems to be the same bug as HHH-1751 Collection corruptly loaded when = join fetching and scrolling (org.hibernate.impl.FetchingScrollableResultsIm= pl) > ScrollableResults JoinFetch don't set child collection correctly=E3=80=80= after the second parent object > -------------------------------------------------------------------------= ---------------------- > > Key: HHH-1283 > URL: http://opensource.atlassian.com/projects/hibernate/browse/H= HH-1283 > Project: Hibernate3 > Type: Bug > Components: core > Versions: 3.1 > Environment: Hibernate 3.1 > Oracle10gR2 > Oracle JDBC Driver 10.2.0.1.0 > Sun JDK 1.5.0_06 > Spring 1.2.6 > Reporter: Masahiro Hirashima > Attachments: ScrollableCollectionFetchingTest.java, ScrollableResults.zi= p > > > ScrollableResults JoinFetch set child collection correctly at first paren= t object. > but after the second parent object, It set only the first element of a c= hild collection. > I made the following tables. > CREATE TABLE owners ( > id NUMBER(36, 0) NOT NULL PRIMARY KEY, > first_name VARCHAR(30), > last_name VARCHAR(30), > address VARCHAR(255), > city VARCHAR(80), > telephone VARCHAR(20), > version NUMBER(36, 0) DEFAULT 0 > ); > CREATE TABLE types ( > id NUMBER(36, 0) NOT NULL PRIMARY KEY, > name VARCHAR(80), > version NUMBER(36, 0) DEFAULT 0 > ); > CREATE TABLE pets ( > id NUMBER(36, 0) NOT NULL PRIMARY KEY, > name VARCHAR(30), > birth_date DATE, > type_id NUMBER(36, 0), > owner_id NUMBER(36, 0), > version NUMBER(36, 0) DEFAULT 0 > ); > and inserted the following data. > INSERT INTO owners VALUES (1, 'Betty', 'Davis', '638 Cardinal Ave.= ', 'Sun Prairie', '6085551749', 0); > INSERT INTO owners VALUES (2, 'Eduardo', 'Rodriquez', '2693 Commerce St.= ', 'McFarland', '6085558763', 0); > INSERT INTO pets VALUES (1, 'Leo', '2000-09-07', 1, 1, 0); > INSERT INTO pets VALUES (2, 'Basil', '2002-08-06', 2, 1, 0); > INSERT INTO pets VALUES (3, 'Rosy', '2001-04-17', 3, 2, 0); > INSERT INTO pets VALUES (4, 'Jewel', '2000-03-07', 4, 2, 0); > INSERT INTO pets VALUES (5, 'Iggy', '2000-11-30', 5, 2, 0); > INSERT INTO types VALUES (1, 'cat', 0); > INSERT INTO types VALUES (2, 'dog', 0); > INSERT INTO types VALUES (3, 'lizard', 0); > INSERT INTO types VALUES (4, 'snake', 0); > INSERT INTO types VALUES (5, 'bird', 0); > and I execute following code. > String hqlJoinFetchTest =3D=20 > "from Owner owner " + > "left outer join fetch owner.pets as pets " + > "left outer join fetch pets.type " + > "order by owner.firstName, owner.lastName"; > Query query =3D session.createQuery(hqlJoinFetchTest); > ScrollableResults cursor =3D query.scroll(); > while ( cursor.next() ) { > Owner owner =3D (Owner)cursor.get(0); > System.out.println(owner); > } > result of this code is following. > petclinic.domain.Owner@15d616e[id=3D1,version=3D0,firstName=3DBetty,lastN= ame=3DDavis, > petclinic.domain.Pet@136d9d8[id=3D2,version=3D0,name=3DBasil,birthDate= =3D2002-08-06, > petclinic.domain.PetType@1be2893[id=3D2,version=3D0,name=3Ddog] > petclinic.domain.Pet@14a75bb[id=3D1,version=3D0,name=3DLeo,birthDate=3D= 2000-09-07, > petclinic.domain.PetType@17779e3[id=3D1,version=3D0,name=3Dcat] > petclinic.domain.Owner@e3570c[id=3D2,version=3D0,firstName=3DEduardo,last= Name=3DRodriquez > petclinic.domain.Pet@167e3a5[id=3D4,version=3D0,name=3DJewel,birthDate= =3D2000-03-07, > petclinic.domain.PetType@1926e90[id=3D4,version=3D0,name=3Dsnake] > First owner object set collection collectly. > but second owner object don't set second pet object(id=3D5) and third pet= object(id=3D6). --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators= .jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |