Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink ElementCollection Duplicates(Eclipselink)
Eclipselink ElementCollection Duplicates [message #1753246] Thu, 02 February 2017 21:49
Reesa Phillips is currently offline Reesa PhillipsFriend
Messages: 2
Registered: November 2016
Junior Member
This appears to be a bug but I want to be sure I am not doing something incorrect. I have the following class relationships:

@Embeddable
public class EmbeddableData implements Serializable {

  @Column(name = "DATA_X", nullable = false)
  private double x;

  @Column(name = "DATA_Y", nullable = false)
  private double y;
  ...
}

@Entity
public class EntityA implements Serializable {

  private static final long serialVersionUID = 1L;

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "ID")
  private long id;

  @CollectionTable(name = "DATA_TABLE", joinColumns = @JoinColumn(name = "ENTITY_FK", nullable = false))
  @ElementCollection
  @OrderColumn(name = "ARRAY_INDEX", nullable = false)
  private List<EmbeddableData> data;
  ...
}


So I persist an instance of EntityA with 4 EmbeddableData instances in the data list which works as expected. Then I change one instance in the list keeping just 4 items and do a merge. However, instead of deleting the old item for the index I changed and then inserting the new item for that index, a new item is inserted which leaves 5 items in the database (2 with the same ARRAY_INDEX). Why is that the case?
Previous Topic:moxy is not able to convert a List<String> to JSON
Next Topic:Issue with Eclipselink LAZY loading
Goto Forum:
  


Current Time: Fri Dec 15 06:35:00 GMT 2017

Powered by FUDForum. Page generated in 0.03183 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software