cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Evgeny Ryabitskiy (JIRA)" <j...@apache.org>
Subject [jira] Created: (CAY-1430) Problems with TINYINT type mapping
Date Tue, 11 May 2010 07:27:42 GMT
Problems with TINYINT type mapping
----------------------------------

                 Key: CAY-1430
                 URL: https://issues.apache.org/jira/browse/CAY-1430
             Project: Cayenne
          Issue Type: Bug
          Components: Core Library
         Environment: MS SQL 2005
            Reporter: Evgeny Ryabitskiy
            Assignee: Evgeny Ryabitskiy
             Fix For: 3.1M1


Today I fount some not nice thing.
If I am selecting from column with TINYINT type, Cayenne trying to map it to Byte
But TINYINT can have values from 0 to 255 (which is greater then Byte).

So I got this:

java.sql.SQLException: Numeric overflow in conversion of value 160 to type TINYINT.
	at net.sourceforge.jtds.jdbc.Support.convert(Support.java:251)
	at net.sourceforge.jtds.jdbc.JtdsResultSet.getByte(JtdsResultSet.java:648)
	at org.apache.cayenne.access.types.ByteType.materializeObject(ByteType.java:48)
	at org.apache.cayenne.access.jdbc.JDBCResultIterator.readDataRow(JDBCResultIterator.java:291)
	at org.apache.cayenne.access.jdbc.JDBCResultIterator.nextDataRow(JDBCResultIterator.java:145)
	at org.apache.cayenne.access.jdbc.JDBCResultIterator.dataRows(JDBCResultIterator.java:115)
	at org.apache.cayenne.access.jdbc.SQLTemplateAction.processSelectResult(SQLTemplateAction.java:212)
	at org.apache.cayenne.access.jdbc.SQLTemplateAction.execute(SQLTemplateAction.java:153)
	at org.apache.cayenne.access.jdbc.SQLTemplateAction.performAction(SQLTemplateAction.java:107)
	at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:59)
	at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:273)
	at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:301)
	at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:60)
	at org.apache.cayenne.access.DataDomainQueryAction$1.transform(DataDomainQueryAction.java:273)
	at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:826)
	at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:270)
	at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:110)
	at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:746)
	at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:217)
	at org.apache.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:54)
	at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1395)
	at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1384)

My idea is to map TINYINT to Short by default. Because:
1) Some databases don't support this type
2) It will handle problem described above
3) I think in 99% cases you don't need it on side of Java application (almost same with short)
or if you need you can easily get it from any Number type.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message