Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367122

Summary: [API] Invalid validation for EclipseLink collection mappings
Product: [WebTools] Dali JPA Tools Reporter: Neil Hauge <neil.hauge>
Component: JPAAssignee: Karen Butzke <karenfbutzke>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jolene.moffitt, karenfbutzke
Version: 3.1Flags: neil.hauge: pmc_approved? (david_williams)
neil.hauge: pmc_approved? (raghunathan.srinivasan)
neil.hauge: pmc_approved? (naci.dai)
neil.hauge: pmc_approved? (deboer)
neil.hauge: pmc_approved+
neil.hauge: pmc_approved? (kaloyan)
neil.hauge: pmc_approved? (cbridgha)
neil.hauge: review+
Target Milestone: 3.2 M7   
Hardware: PC   
OS: Windows 7   
URL: http://www.eclipse.org/forums/index.php?t=rview&goto=748405#msg_748405
Whiteboard: EclipseLink
Bug Depends on:    
Bug Blocks: 378712    
Attachments:
Description Flags
proposed patch against 3.0 maintenance
none
proposed patch against 3.0 maintenance
none
proposed patch again HEAD none

Description Neil Hauge CLA 2011-12-19 14:40:28 EST
EclipseLink allows additional collection mapping types for EAGER relationships, such as TreeSet.  EclipseLink validation should be tweaked to allow for other usage.

For more info see James' comment here:
http://www.eclipse.org/forums/index.php?t=rview&goto=748405#msg_748405
Comment 1 Karen Butzke CLA 2012-01-09 09:04:31 EST
added bug 367122 to support validation for the correct collection types in generic JPA. This particular bug leads to invalid validation because there is no default target entity.
Comment 2 Karen Butzke CLA 2012-01-09 11:31:45 EST
Created attachment 209217 [details]
proposed patch against 3.0 maintenance
Comment 3 Karen Butzke CLA 2012-01-09 16:14:54 EST
Created attachment 209228 [details]
proposed patch against 3.0 maintenance

new patch for maintenance that doesn't change API. I have applied the original patch to HEAD to fix the issue there
Comment 4 Neil Hauge CLA 2012-01-09 17:47:28 EST
Approved pending successful test run.
Comment 5 Karen Butzke CLA 2012-01-09 18:50:15 EST
test passed, fix checked in to maintenance
Comment 6 Karen Butzke CLA 2012-01-19 13:16:53 EST
In Comment 1 I pointed to the wrong bug, the bug for validation the collection type in generic JPA is bug 368156
Comment 7 Jolene Moffitt CLA 2012-01-20 11:41:46 EST
Verified in Build -3.3.2-20120119083703  

Verified when you use TreeSet for the interface for an attribute in an entity for both a Generic project and EL project the target interface error does not appear.  Also verified no errors appear if you use Collection, Set, List and Map interfaces.  See the link to view test steps for verification.
http://wiki.eclipse.org/Dali_3.0.2
Comment 8 Karen Butzke CLA 2012-04-20 16:40:22 EDT
I am reopening this bug because the fix for this will not work for a customer collection defined on the user's project classpath. It also causes a performance issue.
Comment 9 Karen Butzke CLA 2012-04-20 17:07:32 EDT
Given the following entity, the foos 1-m mapping has the incorrect validation error: 'Target entity for "foos" is not defined'

@Entity
public class Foo {

	@OneToMany
	private MyCollection<Foo> foos;
}

public class MyCollection implements Collection {
...
}
Comment 10 Karen Butzke CLA 2012-04-25 21:25:12 EDT
Created attachment 214576 [details]
proposed patch again HEAD

I have made a provisional API change that I do not think is used by our adopters in the interface JavaPersistentAttribute.JpaContainerDefinition
The method isAssignableFrom(String typeName) : boolean has been replaced with getTypeName() : String

This was changed to fix this bug in an earlier milestone of 3.2 and now I am changing it back since the fix was incorrect, so there is no API change from the previous release. I have attached a patch against head to fix the original problem correctly and without the performance impact.
Comment 11 Neil Hauge CLA 2012-04-25 21:54:58 EDT
See comment 9 for more info on the changes and justification for this API change.  Voting this through so we can get this change into this week's I-build.
Comment 12 Karen Butzke CLA 2012-04-26 09:18:29 EDT
fixed in M7