java - EclipseLink fails to create complete JoinTable for ManyToMany -


i'm using eclipselink 2.5 project , encountered little problem manytomany relation:

i have mapped superclass identifiable defines composite key (uuid, revision). both entity classes appointment , content subclasses of identifiable.

now try define unidirectional manytomany relation appointment content, seems eclipselink doesn't create jointable right. there 2 columns in (uuid, revision), there should 4 (one uuid , revision each side of relation).

lust not least, code:

@mappedsuperclass @idclass(identifiablepk.class) public abstract class identifiable implements serializable {      @id     @uuidgenerator(name = "uuid")     @generatedvalue(generator = "uuid")     protected string uuid;      @id     protected integer revision;      /* ... */ } 
public class appointment extends identifiable {      @joincolumns({         @joincolumn(columndefinition = "trainingcontent_uuid", referencedcolumnname = "uuid", nullable = false, updatable = false, insertable = false),         @joincolumn(columndefinition = "trainingcontent_revision", referencedcolumnname = "revision", nullable = false, updatable = false, insertable = false)     })     @manytomany(fetch = fetchtype.lazy)     protected list<trainingcontent> trainingcontents;      /* ... */ } 
public class trainingcontent extends identifiable {     /* ... */ } 

i tried use @jointable instead of @joincolumns, eclipselink complains missing resepectively incomplete @joincolumns annotation, necessary target entities composite keys.

am doing wrong?

greetings, chrert

for manytomany must use @jointable @joincolumns, source , target join columns specified inside @jointable.

your @joincolumn must not have, "updatable = false, insertable = false", makes no sense, not able insert anything, appears happening.

see, https://en.wikibooks.org/wiki/java_persistence/manytomany


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -