Pergunta

ellou'

I have two models Entry and Entrant which has ManyToMany relationship with annotations. While generating the DDL Ebean adds entry_entrant table which contains fields for mentioned models' IDs.

In general I need to extend this table, to add fields for ie date of creation of relationship or user who added the relation.

Is that simplified way to do this with annotations, or should I just create two OneToMany relationships and add manualy model of EntryEntrant association?

Thanks in advance, biesior!

Foi útil?

Solução

I had similar problem with hibernate. I used the second aproach and created a normal class with fields I needed. Than from the 2 other classes (in your case Entry and Entrant) I created @OneToMany relationship to the third class. To be hones it`s a good way case many to many is create by two one-to-one with agregation table. Here you just creating this manualy

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top