From users-return-2416-apmail-openjpa-users-archive=openjpa.apache.org@openjpa.apache.org Thu Jul 10 07:17:35 2008 Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 10479 invoked from network); 10 Jul 2008 07:17:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jul 2008 07:17:35 -0000 Received: (qmail 28758 invoked by uid 500); 10 Jul 2008 07:17:35 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 28739 invoked by uid 500); 10 Jul 2008 07:17:35 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 28728 invoked by uid 99); 10 Jul 2008 07:17:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jul 2008 00:17:35 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [216.252.120.172] (HELO web83601.mail.sp1.yahoo.com) (216.252.120.172) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 10 Jul 2008 07:16:42 +0000 Received: (qmail 74069 invoked by uid 60001); 10 Jul 2008 07:16:04 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=jOYraq0m6EYXuxEPmq4CdjiFwCYdSOWxUCQSr1KwZatGZJu3h0etLpabKW/WxGof+lALFfY3cxFjjt/O6fUqdZyQCuY+RQ7IQS2ihTGWUxmN60ZG1heWtkw+FMIF2wjAZ3OL+5TMBUZzcDzHcLnGqsfbcIa4g+lZyZMeNvVNoTg=; Received: from [59.145.136.1] by web83601.mail.sp1.yahoo.com via HTTP; Thu, 10 Jul 2008 00:16:04 PDT X-Mailer: YahooMailRC/975.45 YahooMailWebService/0.7.199 Date: Thu, 10 Jul 2008 00:16:04 -0700 (PDT) From: Jitendra chintamadaka Subject: Re: Able to remove relation with ManyToMany and no cascade. To: users@openjpa.apache.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-892751631-1215674164=:70233" Message-ID: <107089.70233.qm@web83601.mail.sp1.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org --0-892751631-1215674164=:70233 Content-Type: text/plain; charset=us-ascii Hello, > What exactly does 'remove' imply? Is it something like: > a) team.getStudents().remove(1); > or > b) em.remove(team.getStudents().get(1)); I meant (a). And with just JPA annotation specifications, the remove of entity from a java collection (on owning side) does imply removal of the associated record from the JoinTable (for ManyToMany). >From my Scenario 1 (Using owner of relationship "student") : student.getTeamCollection().remove(0); entityTransaction.commit(); // The record from COLLEGE table related to this student entity PK and the team entity PK removed above, will be deleted. NOTE: This scenario 1, I think is not an expected behavior and can introduce un-expected programming bugs. >From my Scenario 2 (Using inverse of relationship "team") : team.getStudentList().remove(0); entityTransaction.commit(); // The record from COLLEGE table related to this team entity PK and the student entity PK remove above, will not be deleted. NOTE: This scenario 2, behavior is explained by 3.2.3 of JPA specification. So, no questions here. Regarding JPA 2.0, I have not yet reviewed the @OrphanRemoval annotation to comment yet. Will verify that and confirm if its really addressing this issue. Thanks. Regards, Jitendra. --0-892751631-1215674164=:70233--