hello. I have these:
Code:
@Entity
@Table(name="midiaator")
public class MidiaAtor {
@Embeddable
public static class Ids implements Serializable{
@Column(name="idAtor")
private Long idAtor;
@Column(name="idMidia")
private Long idMidia;
public Ids(){}
public void setIds(Long idMidia, Long idAtor){
this.idMidia = idMidia;
this.idAtor = idAtor;
}
public Long getIdAtor() {
return idAtor;
}
public Long getIdMidia() {
return idMidia;
}
}
@EmbeddedId
Ids ids = new Ids();
@ManyToOne
@JoinColumn(name="idMidia", insertable=false, updatable=false)
private Midia midia;
@ManyToOne
@JoinColumn(name="idAtor", insertable=false, updatable=false)
private Ator ator;
Code:
@Entity
@Table(name="ator")
public class Ator {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Column(length=200)
private String nome;
@OneToMany(mappedBy="ator")
private Set<MidiaAtor> ma;
public Set<MidiaAtor> getMa() {
return ma;
}
public void setMa(Set<MidiaAtor> ma) {
this.ma = ma;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
Code:
@Entity
@Table(name="midia")
public class Midia {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Column(length=200)
private String nome;
@OneToMany (mappedBy="")
private Set<MidiaAtor> ma;
Why is it being duplicated the table MidiaAtor?