openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2255) Couldn't load the referencedColumn definition when create the JoinTable
Date Wed, 05 Sep 2012 21:05:07 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449132#comment-13449132
] 

Albert Lee commented on OPENJPA-2255:
-------------------------------------

XieZhi,

Can you provide a more concrete test case and the conditions reproducing the failure?


                
> 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
>            Assignee: Albert Lee
>            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

Mime
View raw message