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

Bug 312255

Summary: JPA:Core: Use generics in Session/Project Maps to avoid casting
Product: z_Archived Reporter: Michael OBrien <michael.f.obrien>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: eclipselink.foundation-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Example refactor of descriptor Map in Project via Session none

Description Michael OBrien CLA 2010-05-10 09:56:54 EDT
>To aide in using Session and Project API with code that is already using generics - 
>we should update this the remaining Map and List instance variables to use generics
- This will possibly involve a deprecation phase first
  Map descriptors;
  Map aliasDescriptors;
- some of the API is already using generics
  Map<String, String> staticMetamodelClasses
  Map<Object, RelationalDescriptor> mappedSuperclassDescriptors;
  Map<String, List<String>> metamodelIdClassMap;
- some generics change will be redundant if the key is Object for instance

protected transient List<DatabaseQuery> queries = null;
>Example: in the following CacheImpl JPA code we need to workaround the missing generic structure in AbstractSession and Project

>before generics
  Iterator<ClassDescriptor> descriptorIterator = getSession().getDescriptors().values().iterator();
    while(descriptorIterator.hasNext()) {
      ClassDescriptor candidateAssignableDescriptor = descriptorIterator.next();

>after generics
  for(ClassDescriptor candidateAssignableDescriptor : getSession().getDescriptors().values()) {
Comment 1 Michael OBrien CLA 2010-05-10 09:58:44 EDT
Created attachment 167705 [details]
Example refactor of descriptor Map in Project via Session
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:28:53 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink