Class Relationship with Primarykey Composite in Hibernate

Asked

Viewed 98 times

1

I have the following relationamentoinserir a descrição da imagem aqui

In the Definition Scale entity I have a composite primary key composed of idEscalaDetailing and idTurma

I’m having doubts to do the reverse mapping between Scaling and Scaling scale using Hibernate because and I have a @Embeddable class as Primary key, as below:

@Embeddable
public class EscalaDiaDetalhePK implements Serializable {

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "mycolmumn")
    protected EscalaDetalhe escalaDia;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "idTurma")
    protected Turma turma;

     //getters , setters , hash and equals
}

I have the Definicaoescala class :

@Entity
@Table(name = "")
public class DefinicaoEscala {

    @EmbeddedId
    private EscalaDiaDetalhePKBean id;
    @ManyToOne  
    private Turno turno;
}

and want to do the Onetomany reverse for the defining entity, I tried it as described below:

@Entity
@Table(name ="ESCALADETALHE")
public class EscalaDetalhe{

   //properties
  @OneToMany(fetch = FetchType.EAGER , mappedBy = "",orphanRemoval = true,cascade = CascadeType.ALL )
    public List<DefinicaoEscala> definicoes;


}

What should I put on mappedBy?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.