Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 9877 invoked from network); 5 Jun 2008 20:42:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jun 2008 20:42:16 -0000 Received: (qmail 60533 invoked by uid 500); 5 Jun 2008 20:42:13 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 60490 invoked by uid 500); 5 Jun 2008 20:42:13 -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 60413 invoked by uid 99); 5 Jun 2008 20:42:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jun 2008 13:42:13 -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; Thu, 05 Jun 2008 20:41:23 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 14A59234C134 for ; Thu, 5 Jun 2008 13:41:45 -0700 (PDT) Message-ID: <685121589.1212698505083.JavaMail.jira@brutus> Date: Thu, 5 Jun 2008 13:41:45 -0700 (PDT) From: "Fay Wang (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-626) @JoinColumn with name attribute causes exception on 1.2.0. In-Reply-To: <1527724416.1212688545356.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602776#action_12602776 ] Fay Wang commented on OPENJPA-626: ---------------------------------- Can you set a break point in (1) AnnotationPersistenceMappingParser: parseJoinColumns(FieldMapping fm, MappingInfo info, boolean secondaryAllowed, JoinColumn... joins) { List cols = new ArrayList(joins.length); int unique = 0; String secondary = null; for (int i = 0; i < joins.length; i++) { cols.add(newColumn(joins[i])); unique |= (joins[i].unique()) ? TRUE : FALSE; secondary = trackSecondaryTable(fm, secondary, joins[i].table(), i); if (!secondaryAllowed && secondary != null) throw new MetaDataException(_loc.get("bad-second", fm)); } setColumns(fm, info, cols, unique); <== set break point here and examine whether cols contains "bus_stop_id" (2) If it does contain "bus_stop_id", can you set a break point in MappingInfo: protected ForeignKey createForeignKey(MetaDataContext context, String prefix, List given, ForeignKeyDefaults def, Table table, ClassMapping cls, ClassMapping rel, boolean inversable, boolean adapt) { assertTable(context, table); if (prefix == null) <== set a break point here to check if paramenter given contains "bus_stop_id" prefix = "generic"; // collect the foreign key columns and their targets Object[][] joins = createJoins(context, prefix, table, cls, rel, given, def, inversable, adapt); <== if it does, set a break point here to see if the resulting joins contains "bus_stop_id" (3) if it does, set a break point in MappingInfo: protected ForeignKey createForeignKey(MetaDataContext context, String prefix, List given, ForeignKeyDefaults def, Table table, ClassMapping cls, ClassMapping rel, boolean inversable, boolean adapt) { ... // add joins to key Column col; for (int i = 0; i < joins.length; i++) { col = (Column) joins[i][0]; if (joins[i][1]instanceof Column) fk.join(col, (Column) joins[i][1]); <== set a break point here to see if col is "bus_stop_id" else if ((joins[i][2] == Boolean.TRUE) != (_join == JOIN_INVERSE)) fk.joinConstant(joins[i][1], col); else fk.joinConstant(col, joins[i][1]); } Please let us know if you get "bus_stio_id" in the last step. If so, we will then go from there to debug further. Thanks! > @JoinColumn with name attribute causes exception on 1.2.0. > ----------------------------------------------------------- > > Key: OPENJPA-626 > URL: https://issues.apache.org/jira/browse/OPENJPA-626 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 1.2.0 > Reporter: Michael Dick > > Creating Issue on behalf of Tim Holloway. Here's his email to the dev mailing list : > @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE) > @JoinColumn(name="bus_stop_id") > private BusStops busStop; > Works in release 1.0.2: > SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation, > t1.in_ > service_date, t1.inbound, t1.latitude, t1.longitude, > t1.out_service_date, t1.sheltered, t1.street1_block, > t2.street_direction_id, t2.description, t1.street1_name, t1.street1 > _qualifier, t3.street_type_id, t3.description, t1.street2_block, > t4.street_direction_id, t4.description, t1.street2_name, > t1.street2_qualifier, t5.street_type_id, t5.descrip > tion, t1.waypoint, t0.clock_point, t0.comments, t0.in_service, > t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound, > t0.schedule_id, t0.stop_sequence, t0.terminu > s, t0.transfer_point FROM public.schedule_stops t0 LEFT OUTER JOIN > public.bus_stops t1 ON t0.bus_stop_id = t1.stop_id LEFT OUTER JOIN > public.lk_street_directions t2 ON t1.st > reet1_direction = t2.street_direction_id LEFT OUTER JOIN > public.lk_street_types t3 ON t1.street1_type = t3.street_type_id LEFT > OUTER JOIN public.lk_street_directions t4 ON t > 1.street2_direction = t4.street_direction_id LEFT OUTER JOIN > public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE > t0.schedule_id = ? ORDER BY t0.stop_seque > nce ASC [params=(int) 50] > Uses synthesized column name instead of declared name in today's CVS > snapshot: > ERROR: column t0.busstop_stop_id does not exist {prepstmnt 17939164 > SELECT t0.schedule_stop_id, t1.stop_id, t1.description, t1.elevation, > t1.in_service_date, t1.inbound, t1.latitude, t1.longitude, > t1.out_service_date, t1.sheltered, t1.street1_block, > t2.street_direction_id, t2.description, t1.street1_name, > t1.street1_qualifier, t3.street_type_id, t3.description, > t1.street2_block, t4.street_direction_id, t4.description, > t1.street2_name, t1.street2_qualifier, t5.street_type_id, > t5.description, t1.waypoint, t0.clock_point, t0.comments, t0.in_service, > t0.in_service_date, t0.inbound, t0.out_service_date, t0.outbound, > t0.SCHEDULE_SCHEDULE_ID, t0.stop_sequence, t0.terminus, > t0.transfer_point > FROM public.schedule_stops t0 > LEFT OUTER JOIN public.bus_stops t1 > ON t0.BUSSTOP_STOP_ID = t1.stop_id > LEFT OUTER JOIN public.lk_street_directions t2 > ON t1.street1_direction = t2.street_direction_id > LEFT OUTER JOIN public.lk_street_types t3 ON t1.street1_type = > t3.street_type_id LEFT OUTER JOIN public.lk_street_directions t4 ON > t1.street2_direction = t4.street_direction_id LEFT OUTER JOIN > public.lk_street_types t5 ON t1.street2_type = t5.street_type_id WHERE > t0.SCHEDULE_SCHEDULE_ID = ? ORDER BY t0.stop_sequence ASC [params=(int) > 50]} [code=0, state=42703] -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.