Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Native Query, ScrollableCursor, Join Fetching, and Duplicate Column Names
Native Query, ScrollableCursor, Join Fetching, and Duplicate Column Names [message #1328911] Fri, 02 May 2014 23:19 Go to next message
Scott Dudley is currently offline Scott DudleyFriend
Messages: 21
Registered: October 2012
Junior Member
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 [1], 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.
Re: Native Query, ScrollableCursor, Join Fetching, and Duplicate Column Names [message #1336870 is a reply to message #1328911] Tue, 06 May 2014 16:03 Go to previous messageGo to next message
Scott Dudley is currently offline Scott DudleyFriend
Messages: 21
Registered: October 2012
Junior Member

Using a native query joining two tables with columns of the same name but different attributes, why does Query.getResultList() work and ScrollableCursor.next() throw a ConversionException?

I appreciate any ideas or pointers.
Re: Native Query, ScrollableCursor, Join Fetching, and Duplicate Column Names [message #1339754 is a reply to message #1336870] Wed, 07 May 2014 20:41 Go to previous message
Scott Dudley is currently offline Scott DudleyFriend
Messages: 21
Registered: October 2012
Junior Member
Still plugging away at this issue. Found that I was able to address the duplicate column names in the joined tables via a SqlResultSetMapping however, it doesn't appear as though I can stream the output of same via either a CursoredStream or ScrollableCursor. An exception is thrown when setting the query hints. Is that true?

Feels like I'm hitting a wall at every turn.
Previous Topic:Update fetching null relationships
Next Topic:CursoredStream or ScrollableCursor with Native Query and SqlResultSetMapping?
Goto Forum:
  


Current Time: Wed Jul 01 23:31:25 GMT 2015

Powered by FUDForum. Page generated in 0.03331 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software