Pessoal tenho as duas classes:
TbLoteLeilao
@NamedQueries({@NamedQuery(name = "TbLoteLeilao.findAll", query = "SELECT t FROM TbLoteLeilao t")})
public class TbLoteLeilao implements Serializable {
@Transient
private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="db_leilao.tb_lote_leilao_seq")
@Basic(optional = false)
@Column(name = "cd_lote_leilao", nullable = false)
private Integer cdLoteLeilao;
@Basic(optional = false)
@Column(name = "nm_lote_leilao", nullable = false, length = 250)
private String nmLoteLeilao;
@Column(name = "ds_lote_leilao", length = 2147483647)
private String dsLoteLeilao;
@Column(name = "vl_lote", precision = 12, scale = 2)
private BigDecimal vlLote;
@Column(name = "ic_lote_finalizado")
private Boolean icLoteFinalizado;
@JoinTable(name = "tb_comprador_lote", catalog = "db_dnaso", schema = "db_leilao", joinColumns = {@JoinColumn(name = "cd_lote_leilao", referencedColumnName = "cd_lote_leilao", nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "cd_parte_comprador", referencedColumnName = "cd_parte", nullable = false)})
@ManyToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
private Set<TbParte> tbParteCollection;
@JoinTable(name = "tb_automovel_lote", catalog = "db_dnaso", schema = "db_leilao", joinColumns = {@JoinColumn(name = "cd_lote_leilao", referencedColumnName = "cd_lote_leilao", nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "cd_automovel_lote", referencedColumnName = "cd_automovel", nullable = false)})
@ManyToMany(mappedBy = "tbLoteLeilaoCollection", fetch = FetchType.EAGER)
private Set<TbAutomovel> tbAutomovelCollection;
@JoinColumn(name = "cd_leilao", referencedColumnName = "cd_leilao")
@ManyToOne(fetch = FetchType.EAGER)
private TbLeilao cdLeilao;
@JoinColumn(name = "cd_parte_vendedor", referencedColumnName = "cd_parte")
@ManyToOne(fetch = FetchType.EAGER)
private TbParte cdParteVendedor;
TbAutomovel
public class TbAutomovel implements Serializable {
@Transient
private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="db_leilao.tb_automovel_seq")
@Basic(optional = false)
@Column(name = "cd_automovel", nullable = false)
private Integer cdAutomovel;
@Column(name = "cd_uf_automovel")
private Integer cdUfAutomovel;
@Column(name = "nr_placa_automovel", length = 250)
private String nrPlacaAutomovel;
@Column(name = "nr_renavam_automovel", length = 250)
private String nrRenavamAutomovel;
@Column(name = "dt_ano_fabricacao_automovel")
private String dtAnoFabricacaoAutomovel;
@Column(name = "dt_ano_modelo_automovel")
private String dtAnoModeloAutomovel;
@Column(name = "nr_codigo_seguranca_crv", length = 250)
private String nrCodigoSegurancaCrv;
@Column(name = "nr_crv")
private Integer nrCrv;
@Column(name = "dt_emissao_crv")
@Temporal(TemporalType.DATE)
private Date dtEmissaoCrv;
@Column(name = "nr_via_crv", length = 250)
private String nrViaCrv;
@Column(name = "dt_venda_automovel")
@Temporal(TemporalType.DATE)
private Date dtVendaAutomovel;
@JoinTable(name = "tb_automovel_lote", catalog = "db_dnaso", schema = "db_leilao", joinColumns = {@JoinColumn(name = "cd_automovel_lote", referencedColumnName = "cd_automovel", nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "cd_lote_leilao", referencedColumnName = "cd_lote_leilao", nullable = false)})
@ManyToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
private Set<TbLoteLeilao> tbLoteLeilaoCollection;
@JoinColumn(name = "cd_modelo_automovel", referencedColumnName = "cd_modelo_automovel")
@ManyToOne(fetch = FetchType.EAGER)
private TbModeloAutomovel cdModeloAutomovel;
qdo eu vou salvar um loteleilao e adiciono varios automoveis, ele salva os registros na tabela de ligacao tb_automovel_lote porem qdo eu altero o loteleilao, removendo algum automovel ele nao remove da tabela de ligacao, ja tentei todos os cascade possiveis e nada… alguem pode me ajudar? (ainda nao teste em add um automovel novo, mas acredito q funfe)
valeu