Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F0FDDD168 for ; Wed, 5 Sep 2012 02:40:07 +0000 (UTC) Received: (qmail 4624 invoked by uid 500); 5 Sep 2012 02:40:07 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 4597 invoked by uid 500); 5 Sep 2012 02:40:07 -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 4584 invoked by uid 99); 5 Sep 2012 02:40:07 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 02:40:07 +0000 Date: Wed, 5 Sep 2012 13:40:07 +1100 (NCT) From: "xiezhi (JIRA)" To: dev@openjpa.apache.org Message-ID: <1648809796.37011.1346812807633.JavaMail.jiratomcat@arcas> In-Reply-To: <439721021.19818.1346375767417.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (OPENJPA-2255) Couldn't load the referencedColumn definition when create the JoinTable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13448409#comment-13448409 ] xiezhi commented on OPENJPA-2255: --------------------------------- Thanks,Albert. I got your patch, and apply it into my server (geronimo-tomcat7-javaee6-3.0.0), The warning message mentioned in the jira did disappear, but another message occurred. Same message, same problem. But the difference is the column is defined in ManyToOne annotation. The source is below. @ManyToOne(optional=true, cascade={CascadeType.PERSIST, CascadeType.MERGE}) @JoinColumn(name="classField") private Location schoolField; The message is below. 2012-09-05 09:19:58,293 WARN [Schema] Existing column "classField" on table "test.classField" is incompatible with the same column in the given schema definition. Existing column: Full Name: classes.classField Type: varchar Size: 255 Default: null Not Null: false Given column: Full Name: classes.classField Type: varchar Size: 128 Default: null Not Null: false > Couldn't load the referencedColumn definition when create the JoinTable > ----------------------------------------------------------------------- > > Key: OPENJPA-2255 > URL: https://issues.apache.org/jira/browse/OPENJPA-2255 > Project: OpenJPA > Issue Type: Bug > Components: jpa > Affects Versions: 2.1.1 > Reporter: xiezhi > Priority: Minor > Labels: documentation, patch > Attachments: OPENJPA-2255.patch > > > The JoinColumn couldn't have the referencedColumn's definition which includes the length definition. and it's length should be assigned to the default value 255. > @Entity > public class Student { > @Id @Column(name="id", length=128, nullable=false) private String id; > @Column(name="sName", length=255) private String sName; > @ManyToMany > @JoinTable( > name="student_course_map", > joinColumns={@JoinColumn(name="student_id", referencedColumnName="id", nullable=false)}, > inverseJoinColumns={@JoinColumn(name="course_id", referencedColumnName="id", nullable=false)} > ) > public Collection getCourses() > ... > } > @Entity > public class Courses{ > @Id @Column(name="id", length=128, nullable=false) private String id; > @Column(name="cName", length=255) private String cName; > ... > } > We can see the student id length has been defined to 128. And there is no definition length in the JoinColumn student_id. The JoinColumn should be set to the default value 255. > The warning message will occur like this > WARN [Schema] Existing column "student_id" on table "test.student_course_map" is incompatible with the same column in the given schema definition. Existing column: > Full Name: student_course_map.student_id > Type: varchar > Size: 128 > Default: null > Not Null: true > Given column: > Full Name: student_course_map.student_id > Type: varchar > Size: 255 > Default: null > Not Null: true -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira