openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gary <daxie...@gmail.com>
Subject Re: Existing column XXX on table XXXX is incompatible with the same column in the given schema definition.
Date Tue, 28 Aug 2012 01:48:23 GMT
I give a complete sample to explain my issue.

@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




--
View this message in context: http://openjpa.208410.n2.nabble.com/Existing-column-XXX-on-table-XXXX-is-incompatible-with-the-same-column-in-the-given-schema-definitio-tp7580948p7580955.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Mime
View raw message