| Summary: | JPA getSingleResult of a scalar native query return different classes | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Ivan Belis <ivan.belis> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | rick.sapir, tom.ware |
| Version: | unspecified | Keywords: | Documentation |
| Target Milestone: | --- | Flags: | rick.sapir:
documentation+
|
| Hardware: | All | ||
| OS: | All | ||
| URL: | http://wiki.eclipse.org/EclipseLink/Release/2.1.2#Known_Issues | ||
| Whiteboard: | |||
This requires a release note. Added as known issue in 2.1.2 rel notes http://wiki.eclipse.org/EclipseLink/Release/2.1.2#Known_Issues Pls review for technical accuracy. Doc'd in release note (In reply to comment #2) Thank's Rick for adding that to the release note. Maybe it is also worth mentioning the behavior with a single column (BigDecimal in Eclipselink 2 versus a List with a BigDecimal on in Eclipselink 1). Greetings, Ivan Belis > Added as known issue in 2.1.2 rel notes > > http://wiki.eclipse.org/EclipseLink/Release/2.1.2#Known_Issues > > Pls review for technical accuracy. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Build Identifier: 2.1.2.v20101206-r8635 While migrating from EclipseLink 1 to the latest 2.1.2 we have encountered an incompatibillity when using native queries. The result class of calling getSingleresult on a native query is different between eclipselink version 1.0.2 and 2.1.2 Example: Query q = em.createNativeQuery("SELECT '1' FROM dual "); Object obj = q.getSingleResult(); In EclipseLink 1.0.2 this will give a List with as first element a BigDecimal. In EclipseLink 2.1.2 this will return a BigDecimal. This means that upgrading from a 1 to version 2 means modifying code. If the current behaviour is correct (as i presume it is) then this should be documented in a release note or an upgrade note. Another test case but now with multiple columns: Query q = em.createNativeQuery("SELECT 1,2 FROM dual "); Object obj = q.getSingleResult(); In EclipseLink 1.0.2 this will give a List with as first element a BigDecimal. In EclipseLink 2.1.2 this will return an Array with as first element a BigDecimal. Greetings, Ivan Belis Reproducible: Always Steps to Reproduce: 1. Create native query that returns a scalar non entity, for example Query q = em.createNativeQuery("SELECT '1' FROM dual "); Object obj = q.getSingleResult(); 2. Examine the class returned by query.getSingleResult 3. Run with EclipseLink 1 4. Run with EclipseLink 2