It might be this bug:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2262
-marina
glassfish_at_javadesktop.org wrote:
> I have a many-to-many relationship between two entities. One of them has composite primary key as follow:[code]@Entity
> public class EntityOne implements Serializable {
> @Id
> @Column(name="LONG_ID")
> private Long LongId;
>
> @ManyToMany
> @JoinTable(name="JOIN_TABLE",
> joinColumns=_at_JoinColum(name="ONE_LONG_ID", referencedColumn="LONG_ID"),
> inverseJoinColumns={
> @JoinColumn(name="TWO_LONG_ID", referencedColumn="LONG_ID"),
> @JoinColumn(name="TWO_STRING_ID", referencedColumn="STRING_ID")
> }
> )
> private List<EntityTwo> entitiesTwo;
> .
> .
> .
> }
>
>
> @Entity
> @IdClass(EntityTwoPK.class) // assume this class is already created
> public class EntityTwo implements Serializable {
> @Id
> @Column(name="LONG_ID")
> private Long LongId;
> @Id
> @Column(name="STRING_ID", length=3) // attention here: I defined the size of String here!
> private String StringId;
>
> @ManyToMany(mappedBy="entitiesTwo")
> private List<EntityTwo> entitiesOne;
> .
> .
> .
> }[/code]
> The java2db feature create the three tables at deploy-time, but the foreign key between the join table and the EntityTwo table does not works 'cause the columns STRING_ID in them are incompatibles. In EntityTwo table it's type is defined as VARCHAR(3) and in the JOIN_TABLE table it's defined as VARCHAR(255).
> I tried to add [b]columnDefinition="VARCHAR(3)"[/b] in the JoinColumn anotation that defines the inverse column inside the join table definition, but the result tables are still the same.
> What am I doing wrong??
> [Message sent by forum member 'samflores' (samflores)]
>
> http://forums.java.net/jive/thread.jspa?messageID=203901
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>