|Native Query, ScrollableCursor, Join Fetching, and Duplicate Column Names [message #1328911]
||Fri, 02 May 2014 23:19
| Scott Dudley
Registered: October 2012
Today encountered a ConversionException that didn't make any sense (to me). After a little more digging, I think I see the issue.|
I have a native query that joins two tables that contain the same column name. I'm using the eclipselink.join-fetch hint. If I call Query.getResultList(), no issue. All rows are returned and everything is in order. If instead I obtain and iterate a ScrollableCursor, I encounter the following exception on a handful of rows:
05/02 15:06:42.154|http-apr-8888-exec-5|SUPER SUPER|DEBUG|TAS|com.telesoft|PaginatingViewHelper.writeData() Local Exception Stack:
Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object , of class [class java.math.BigDecimal], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[closed-->MAS
TER_FEED.CLOSED]] with descriptor [RelationalDescriptor(com.telesoft.teleips.persistent.MasterFeed --> [DatabaseTable(MASTER_FEED)])], could not be converted
to [class java.sql.Date].
My query is joining tables master_feed and accounting_period. master_feed.closed is a date and accounting_period.closed is a numeric. I added a try/catch around the offending line and captured and iterated the ResultSet. I can see that it's misinterpreting the numeric as the date.
Why does Query.getResultList() work and ScrollableCursor.next() not? Same query.
Powered by FUDForum
. Page generated in 0.11168 seconds