Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 31597 invoked from network); 21 Nov 2008 20:00:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Nov 2008 20:00:08 -0000 Received: (qmail 23144 invoked by uid 500); 21 Nov 2008 20:00:17 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 23122 invoked by uid 500); 21 Nov 2008 20:00:17 -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 23111 invoked by uid 99); 21 Nov 2008 20:00:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Nov 2008 12:00:17 -0800 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists+1214986160035-208411@n2.nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Nov 2008 19:58:51 +0000 Received: from tervel.nabble.com ([192.168.236.150]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1L3cAB-0001ve-N5 for users@openjpa.apache.org; Fri, 21 Nov 2008 11:59:35 -0800 Message-ID: <1227297575709-1563278.post@n2.nabble.com> Date: Fri, 21 Nov 2008 11:59:35 -0800 (PST) From: ruslan To: users@openjpa.apache.org Subject: Re: AW: How to make compound id via @EmbeddedId In-Reply-To: <298204.72471.qm@web27801.mail.ukl.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: ruslanv@gmail.com References: <298204.72471.qm@web27801.mail.ukl.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org That is surprise to me. Thanks a lot for pointing out. I didn't know that @Embeddable classes have to be registered in persistence.xml because I thought it's necessary only for entity classes. Perhaps it would be great to mention it in section "1.4. Embeddable" of the documentation. Another interesting thing is that I can't register inner class in persistence.xml like db.ElectronicBooksDataEntity2.PrimaryKey Here is example of the class: http://pastebin.ca/1263719 Is it by design or a bug ? OpenJPA doesn't enhance it. So I had to make PrimaryKey public and move to upper level. Now it works but only if I use primitives in PrimaryKey. Here are my classes: ElectronicBooksDataEntity2: http://pastebin.ca/1263723 PrimaryKey: http://pastebin.ca/1263728 Could you please tell me what I need to modify in PrimaryKey in order to make PrimaryKey.book an object of ElectronicBooksEntity rather than numerical int ? Here is what I tried: http://pastebin.ca/1263733 I also tried to define @OneToMany relation in ElectronicBooksEntity (even though I want to have unidirectional relation) as: @OneToMany(mappedBy="primaryKey.book", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private List datas; but it didn't help either. PS. There was another person who asked exactly the same question: http://n2.nabble.com/How-to-make-compound-id-via-%40EmbeddedId-td1559454.html but looks like he wasn't able to crack it down either. Mark Struberg wrote: > > All other classes have been enhanced? > > Let's start with the most obvious: is the PrimaryKey registered in > your persistence.xml? @Embeddable also have to be registered there. > > LieGrue, > strub > -- View this message in context: http://n2.nabble.com/How-to-make-compound-id-via-%40EmbeddedId-tp1559454p1563278.html Sent from the OpenJPA Users mailing list archive at Nabble.com.