Bug 521790 - Id Class do not use same access type as entity class
Summary: Id Class do not use same access type as entity class
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-03 22:02 EDT by hawk xu CLA
Modified: 2022-06-09 10:14 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hawk xu CLA 2017-09-03 22:02:22 EDT
1. I declared an entity class to use Property Access by put @Id Annotation on Getter Methods

2. the entity class using @IdClass annotation and declared as JavaFX property format.

3. the id class declared as JavaFX property format also.

4. when using EntityManager.find(<id class object>), the EntityManager can not get result

5. I debug and debug, then found that the EclipseLink always use FieldAccess for the Id Class object even the Entity Class set to Property Access

6. Please see org.eclipse.persistence.internal.jpa.CMP3Policy source code:
it use PropertyAccess only if NoSuchField in Id Class:

try {
  pkAttributes[i] = new FieldAccessor(this, getField(currentKeyClass, fieldName), fieldName, field, mapping, currentKeyClass != keyClass);
  fieldToAccessorMap.put(field, pkAttributes[i]);
  noSuchElementException = null;
} catch (NoSuchFieldException ex) {
  String getMethodName = null;
  String setMethodName = null;
  .....
}
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:07:23 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:14:21 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink