Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @ElementCollection List<String> dont delete first record on merge(@ElementCollection List<String> dont delete first record on merge)
@ElementCollection List<String> dont delete first record on merge [message #668426] Thu, 05 May 2011 11:49 Go to next message
ssamayoa  is currently offline ssamayoa
Messages: 2
Registered: May 2011
Junior Member
I was figthing with this strange behaviour, let me explan:

I have an entity with this element collection property:

@ElementCollection
@CollectionTable(name = "adm_alert_group_emails", joinColumns = @JoinColumn(name = "group_id", nullable = false))
@Column(name = "e_mail", length = 64, nullable = false)
public List<String> getEmails() {
return emails;
}

In web front end (JSF) the entity is detached and stored in a session backing bean. User make changes to it then the entity is merged. The problem is that ALLWAYS the first element of the collection remains even if was deleted before merge, other elements are stored correctly.

I thought tha may be there is a bug in eclipse link (unlikely but I could be) but to test that I did a simple test case but worked as expected. The differences between real code and test case are:

- Real code gets the entity manager via injection (@PersistenceContext annotation)
- Test case is simple pojo which gets the entity manager via entity manager factory.
- Real code uses JTA transactions and get the user transaction via injection via XA data source.
- Test case uses resource local and gets its connection directly via javax.persistence.jdbc.* properties.

The real application is running on Weblogic 10.3.4 with eclipselink 2.1.2.

Has someone experienced this behaviour?

Regards.
Re: @ElementCollection List<String> dont delete first record on merge [message #669210 is a reply to message #668426] Mon, 09 May 2011 09:52 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Does your test use the agent or static weaving?

The difference could be the WLS test is automatically weaved, and the issue is related to weaving.

Try using the agent in your test outside WLS to try to recreate the error. If this is the issue it could have something to do with change tracking and setting "eclipselink.weaving.changetracking"="false" may resolve it (or using @ChangeTracking(DEFERRED)).

Try the latest 2.2 or 2.3 build to see if the issue is resolved.

Otherwise, print the value of the collection on the entity being merged and the entity merging into before and after the merge. Is the first element correct? What happens if you clear the collection entirely?


James : Wiki : Book : Blog : Twitter
Previous Topic:getting PSQLException Can't infer the SQL type to use with Native Query call
Next Topic:Oracle ORDERED USE_NL and Eclipselink
Goto Forum:
  


Current Time: Thu Apr 17 05:42:51 EDT 2014

Powered by FUDForum. Page generated in 0.01951 seconds