JDBC datatype of MySQL INT UNSIGNED is mapped as java.lang.Integer should be java.lang.Long
-------------------------------------------------------------------------------------------
Key: CAY-639
URL: http://issues.apache.org/cayenne/browse/CAY-639
Project: Cayenne
Type: Bug
Components: Cayenne Core Library
Versions: 1.2 [STABLE]
Environment: MySQL 5.0.22-standard
jdbc driver mysql-connector-java-3.1.13-bin.jar
Reporter: Tobias Schoessler
A MySQL PK column is defined as INT UNSIGNED.
When reverse engineering the modeller creates a mapping of
<db-attribute ... type="INTEGER" length="10"/>
for this column.
When retrieving the PK via
getObjectId().getIdSnapshot().get(PK_COLUMN_NAME)
java.lang.Integer is returned though it should be a java.lang.Long
see
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-type-conversions.html
this problem is related to a bug in the MySQL jdbc driver 3.0.8/3.1.13 which is always returning java.lang.Long values for AUTO_INCREMENT columns.
See http://lists.mysql.com/java/6383
a workaround is to define the AUTO_INCREMENT column as INT UNSIGNED and set the cayenne mapping to
<db-attribute ... type="BIGINT" length="10"/>
manually
this forces cayenne to return java.lang.Long when querying the column.
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/cayenne/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
This archive was generated by hypermail 2.0.0 : Tue Aug 29 2006 - 09:59:09 EDT