cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Evgeny Ryabitskiy (JIRA)" <>
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
             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(
	at net.sourceforge.jtds.jdbc.JtdsResultSet.getByte(
	at org.apache.cayenne.access.types.ByteType.materializeObject(
	at org.apache.cayenne.access.jdbc.JDBCResultIterator.readDataRow(
	at org.apache.cayenne.access.jdbc.JDBCResultIterator.nextDataRow(
	at org.apache.cayenne.access.jdbc.JDBCResultIterator.dataRows(
	at org.apache.cayenne.access.jdbc.SQLTemplateAction.processSelectResult(
	at org.apache.cayenne.access.jdbc.SQLTemplateAction.execute(
	at org.apache.cayenne.access.jdbc.SQLTemplateAction.performAction(
	at org.apache.cayenne.access.DataNodeQueryAction.runQuery(
	at org.apache.cayenne.access.DataNode.performQueries(
	at org.apache.cayenne.access.DataDomainQueryAction.runQuery(
	at org.apache.cayenne.access.DataDomainQueryAction.access$000(
	at org.apache.cayenne.access.DataDomainQueryAction$1.transform(
	at org.apache.cayenne.access.DataDomain.runInTransaction(
	at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(
	at org.apache.cayenne.access.DataDomainQueryAction.execute(
	at org.apache.cayenne.access.DataDomain.onQuery(
	at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(
	at org.apache.cayenne.access.DataContextQueryAction.execute(
	at org.apache.cayenne.access.DataContext.onQuery(
	at org.apache.cayenne.access.DataContext.performQuery(

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.

View raw message