Hi, 
I am developing an EJB 3.0 web 
app on Oracle WebLogic Server 11gR1 PatchSet 1, and I am having problems 
on 
update/delete with the relationship. 
I have an entity Customer with two 
children DiscountCode an MicroMarket. The relation is many Customer has 
one 
DiscountCode and many Customer has one MicroMarket. On the other direction it 
leaves as one DiscountCode 
has many Customer and one MicroMarket has many 
Customer. 
This is my code snippet, 
Customer.- 
 
 
public class Customer implements Serializable {  
    private static final long serialVersionUID = 1L;  
  
    @Id  
    @Column(name="CUSTOMER_ID")  
    private long customerId;  
  
    private String addressline1;  
  
    private String addressline2;  
  
    private String city;  
  
    @Column(name="CREDIT_LIMIT")  
    private BigDecimal creditLimit;  
  
    private String email;  
  
    private String fax;  
  
    private String name;  
  
    private String phone;  
  
    private String state;  
  
      
    @ManyToOne(cascade=CascadeType.MERGE)  
    @JoinColumn(name="DISCOUNT_CODE")  
    private DiscountCode discountCodeBean;  
  
      
    @ManyToOne(cascade=CascadeType.ALL)  
    @JoinColumn(name="ZIP_CODE")  
    private MicroMarket microMarket;  
  
        ..........................................   
}
 
MicroMarket.- 
 
 
public class MicroMarket implements Serializable {  
    private static final long serialVersionUID = 1L;  
  
    @Id  
    @Column(name="ZIP_CODE")  
    private String zipCode;  
  
    @Column(name="AREA_LENGTH")  
    private BigDecimal areaLength;    
 
    @Column(name="AREA_WIDTH")  
    private BigDecimal areaWidth;  
  
    private BigDecimal radius;  
  
      
    @OneToMany(mappedBy="microMarket", cascade=CascadeType.ALL)  
    private List<Customer> customers;  
  
        .......................................    
}
 
The problem I am having is when I update the 
MicroMarket.zipCode in a Customer I get another record of 
MicroMarket 
instead of the updated MicroMarket. 
On deletion a Customer it does 
not delete the MicroMarket. 
 
Well, I work only with Customer. 
So what I would like is when I delete a Customer 
just only the MicroMarket 
child would be deleted. 
The problem I have is that MicroMarket child is 
not deleted. That is wrong. 
On the other hand the table corresponding to 
the DiscountCode entity must 
leaves as it is without no update, no insert 
and no delete. 
Regards,
Jose