Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 48187 invoked from network); 2 Sep 2008 21:28:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Sep 2008 21:28:35 -0000 Received: (qmail 72450 invoked by uid 500); 2 Sep 2008 21:28:33 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 72420 invoked by uid 500); 2 Sep 2008 21:28:33 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 72408 invoked by uid 99); 2 Sep 2008 21:28:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2008 14:28:33 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2008 21:27:43 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2C3E8234C1C3 for ; Tue, 2 Sep 2008 14:27:44 -0700 (PDT) Message-ID: <705086833.1220390864172.JavaMail.jira@brutus> Date: Tue, 2 Sep 2008 14:27:44 -0700 (PDT) From: "Fay Wang (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-707) Recursively related entities not loaded In-Reply-To: <1455257185.1220114384240.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-707?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Fay Wang updated OPENJPA-707: ----------------------------- Attachment: test.jar I could not reproduce this problem. Attached is my test case based on the d= escription of this JIRA. My backend is DB2. The test case works just fine.= =20 > Recursively related entities not loaded > --------------------------------------- > > Key: OPENJPA-707 > URL: https://issues.apache.org/jira/browse/OPENJPA-707 > Project: OpenJPA > Issue Type: Bug > Components: jpa > Affects Versions: 1.1.0 > Environment: * [OpenJPA 1.1.0] > * [derby 10.4.1.3] > * [java hotspot 1.6.0_06-b02] > * [ubuntu 8.04.1 2.6.24-19-generic]=20 > Reporter: Antonio S=C3=A1nchez > Attachments: test.jar > > > OpenJPA is failing to load data from the database in recursive > many-to-one relationships (and possibly other types of relationships). > CASE (Steps 1 to 4 follow) ----------> > STEP 1.- I'm using a recursive table (most probably the same case > applies for non-recursive relationships): > create table "SA"."RECURSIVA" ( > PK int primary key not null, > DATO varchar(10), > PADRE int references RECURSIVA > ); > INSERT INTO "SA"."RECURSIVA" (PK,DATO,PADRE) VALUES (0,'Raiz',null); > INSERT INTO "SA"."RECURSIVA" (PK,DATO,PADRE) VALUES (1,'n1',0); > INSERT INTO "SA"."RECURSIVA" (PK,DATO,PADRE) VALUES (2,'n2',1); > INSERT INTO "SA"."RECURSIVA" (PK,DATO,PADRE) VALUES (3,'n3',2); > INSERT INTO "SA"."RECURSIVA" (PK,DATO,PADRE) VALUES (4,'n4',3); > INSERT INTO "SA"."RECURSIVA" (PK,DATO,PADRE) VALUES (5,'n5',4); > INSERT INTO "SA"."RECURSIVA" (PK,DATO,PADRE) VALUES (6,'n6',5); > INSERT INTO "SA"."RECURSIVA" (PK,DATO,PADRE) VALUES (7,'n7',6); > STEP 2.- This is the entity (the recursive many-to-one relationship is > supposed to be eagerly fetched, according to the spec.): > @Entity > @Table(name =3D "RECURSIVA") > public class Recursiva implements Serializable { > @Id > @Column(name =3D "PK", nullable =3D false) > private Integer pk; > @Column(name =3D "DATO") > private String dato; > @OneToMany(mappedBy =3D "padre") > private Collection recursivaCollection; > @JoinColumn(name =3D "PADRE", referencedColumnName =3D "PK") > @ManyToOne > private Recursiva padre; > .... > STEP 3.- This is the data retrieval code. > EntityManagerFactory emf =3D > Persistence.createEntityManagerFactory("mijpa");; > EntityManager em =3D emf.createEntityManager(); > Recursiva rc =3D null; > =20 > rc =3D em.find(Recursiva.class, 7); =20 > =20 > while (rc !=3D null) { > System.out.println(rc.getDato()); > rc =3D rc.getPadre(); > } > =20 > em.close(); > emf.close(); > STEP 4.- Results: > n7 > n6 > I would have expected to be printed the whole hierarchy up to the root, > i.e.: n7 n6 n5 n4 n3 n2 n1 Raiz > NOTE: TopLink Essentials does it as expected. --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.