[
https://issues.apache.org/cayenne/browse/CAY-1125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169#action_13169
]
Ricardo Ghisi Tobaldini commented on CAY-1125:
----------------------------------------------
Sorry for the lack of details, here it goes.
>> Forcing the type to INTEGER in the map.xml changes anything.
> Could you please clarify this - does it fix the problem or not?
> What query is causing the error? Could you post a stack trace of the
> exception?
I have discovered now that, when I use a SelectQuery() to retrieve all the rows
of a table, I can read the unsigned smallint values (as Integers) AFTER I force
the type to java.lang.Integer (on the map.xml).
But when I use a SQLTemplate with a query of the kind "select * from", even
with java.lang.Integer on the map.xml, raises an exception
(com.mysql.jdbc.exceptions.jdbc4.MySQLDataException)
Following this post I will attach the stack trace, the dump of the database
used in the tests and the source of the tests.
Thanks, Andrus, for the feedback :)
> MySQL SMALLINT UNSIGNED is mapped as java.lang.Short, should be
> java.lang.Integer
> ---------------------------------------------------------------------------------
>
> Key: CAY-1125
> URL: https://issues.apache.org/cayenne/browse/CAY-1125
> Project: Cayenne
> Issue Type: Bug
> Components: Cayenne Core Library
> Affects Versions: 2.0 [STABLE]
> Environment: Ubuntu Linux 8.04, Java 1.6.0_07, MySQL
> 5.0.51a-3ubuntu5.1, MySQL Connector/J 5.1.6
> Reporter: Ricardo Ghisi Tobaldini
> Assignee: Andrus Adamchik
> Attachments: stacktrace.txt
>
>
> When trying to retrieve the value of a column that is of type "SMALLINT
> UNSIGNED" an exception of type
> com.mysql.jdbc.exceptions.jdbc4.MySQLDataException is raised.
> This only happens if the value on that column is greater than 32767, since it
> overflows the Java Short type (that is always signed).
> Forcing the type to INTEGER in the map.xml changes anything.
> It seems that Cayenne is using a getShort() when it should use getInteger()
> (the later is always needed when using the unsigned version of SMALLINT in
> the database, doesn't it?).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.