Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Insertions missing

Eclipselink version: 2.0.0
 
Consider the following simplification of my actual business case:
 
A Company entity has a collection of Employee entities
 
@Entity
@Cache(shared = true, expiry = 900000)
@Table(name = "COMPANIES ")
public class Company {
  @OneToMany(mappedBy = "company", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
  @PrivateOwned
  public List<Employee> getEmployees() {
    return this.employees;
  }
 
@Entity
@Cache(shared = true, expiry = 900000)
@Table(name = "EMPLOYEES ")
public class UsFinance {
  @ManyToOne(fetch = FetchType.EAGER)
  @JoinColumn(name = "COMPANY_ID", nullable = false)
  private Company company;
  …
}
 
Consider the case where a Company has 3 Employees (E1, E2 & E3). 
 
The user of the application (using the user interface) deletes E3 & adds E4.  The logic works correctly and E3 is removed from the database and an E4 is inserted.
 
Next, the user deletes E4 and adds E5.  Now when application attempts to perform this operation, I am told that the employees collection that is owned by the Company object does not contain an E4!!
 
How come?  Recall that in the previous step the insert happened correctly.  Equally puzzling – not to mention aggravating – is that if slowly step through the logic in a debugger I do not see any error.
 
I should also mention an ominous warning I see when I build the application: could not be weaved for change tracking as it is not supported by its mappings.
 
I have not figured its cause and I don’t know if this has any bearing on my current problem.
 
Sri
 

Back to the top