Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323615 - More type safety of DynamicType
Summary: More type safety of DynamicType
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Mike Norman CLA
QA Contact:
URL:
Whiteboard: submitted_patch dynamic
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-25 10:27 EDT by Frank Schwarz CLA
Modified: 2022-06-09 10:06 EDT (History)
3 users (show)

See Also:


Attachments
Proposed change (1.10 KB, patch)
2010-08-25 10:28 EDT, Frank Schwarz CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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