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

Bug 323615

Summary: More type safety of DynamicType
Product: z_Archived Reporter: Frank Schwarz <fs5>
Component: EclipselinkAssignee: Mike Norman <michael.norman>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: michael.f.obrien, michael.norman, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: submitted_patch dynamic
Attachments:
Description Flags
Proposed change none

Description Frank Schwarz CLA 2010-08-25 10:27:48 EDT
Build Identifier: trunk (2.2.0)

Please consider making DynamicType more type-safe, in particular the method "getJavaType":

public Class<? extends DynamicEntity> getJavaClass();
vs.
public Class<?> getJavaClass();


This would allow code like this:
CriteriaBuilder criteriaBuilder = entityManagerFactory.getCriteriaBuilder();
CriteriaQuery<DynamicEntity> criteriaQuery = criteriaBuilder.createQuery(DynamicEntity.class);
Root<? extends DynamicEntity> personR = criteriaQuery.from(helper.getType("Person").getJavaClass());
criteriaQuery.select(personR);
TypedQuery<DynamicEntity> query = entityManager.createQuery(criteriaQuery);

instead of this:
CriteriaBuilder criteriaBuilder = entityManagerFactory.getCriteriaBuilder();
CriteriaQuery<DynamicEntity> criteriaQuery = criteriaBuilder.createQuery(DynamicEntity.class);
@SuppressWarnings("unchecked")
Root<DynamicEntity> personR = (Root<DynamicEntity>) criteriaQuery.from(helper.getType("Person").getJavaClass());
criteriaQuery.select(personR);
TypedQuery<DynamicEntity> query = entityManager.createQuery(criteriaQuery);


Please close this feature request if I am mistaken on the nature of DynamicType/DynamicEntity.

Reproducible: Always
Comment 1 Frank Schwarz CLA 2010-08-25 10:28:51 EDT
Created attachment 177427 [details]
Proposed change
Comment 2 Mike Norman CLA 2010-09-02 11:38:55 EDT
set (tentatively) for inclusion in 2.2
Comment 3 Mike Norman CLA 2010-09-08 10:29:19 EDT
Frank - thank you very much for your constructive feedback!

checked into TRUNK (2.2 stream) SVN revision: 8153
 - all core, JPA and Dynamic JAXB tests pass
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:06:14 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink