错误关系ManyToMany,帮助我

时间:2017-08-31 17:52:34

标签: jpa eclipselink persistence

@Embeddable
public class TaquillasBOPK implements Serializable {
  private static final long serialVersionUID = 1L;

  @Column(name="id_taquilla")
  private int idTaquilla;

  @Column(name="id_banca", insertable=false, updatable=false)
  private int idBanca;

@Entity
@Table(name="sda_taquillas_015")
public class TaquillasBO extends com.base.BaseBO implements Serializable {
  private static final long serialVersionUID = 1L;

  @EmbeddedId
  private TaquillasBOPK id; // 

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "id_banca", referencedColumnName = "id_banca")
  private BancaBO bancaT;

  private String activo;

  @Column(name="direccion_taquilla")
  private String direccionTaquilla;
@Embeddable
public class UsuariosBOPK implements Serializable {
  private static final long serialVersionUID = 1L;

  @Column(name = "id_usuario")
  private Integer idUsuario;

  @Column(name = "id_banca", insertable = false, updatable = false)
  private Integer idBanca;

@Entity
@Table(name = "sda_usuarios_003")
public class UsuariosBO extends com.base.BaseBO implements Serializable {
  private static final long serialVersionUID = 1L;

  @EmbeddedId
  private UsuariosBOPK id;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "id_banca", referencedColumnName = "id_banca")
  private BancaBO banca;
@Entity
@Table(name = "sda_banca_001")
public class BancaBO extends com.base.BaseBO implements Serializable {
  private static final long serialVersionUID = 1L;

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "id_banca")
  private Integer idBanca;

  @OneToMany(mappedBy = "banca")
  private List<UsuariosBO> users;

  @OneToMany(mappedBy = "bancaT")
  private List<TaquillasBO> office;

  private String ciudad;

  private String estado;

我在一个名为taquilla_usuario的表中有三个相关实体,其中包含id_taquilla,id_banca和id_usuario,其中id_banca与BancaBO(sda_banca_0XX)和UsuariosBO(sda_usuarios_0XX)相同,除了另一个字段String之外,我该如何映射该关系?在这里我把实体,我说西班牙语,我必须翻译成谷歌翻译。

https://i.imgur.com/xi1eb08.png图像关系表“taquilla_usuario”。 JPA 2.1 EclipseLink

0 个答案:

没有答案