Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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?
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: Wed Jul 23 19:18:35 EDT 2025

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

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

Back to the top