Hello,
after upgrading from 3.0 to 3.0.1 I am getting
java.lang.ClassCastException: java.lang.Byte cannot be cast to
java.lang.Integer
..uppressWarnings("unchecked")
private Integer getMaxOrderingFromUserBookmark(DataContext context, User
user) {
SQLTemplate template = new SQLTemplate(UserBookmark.class,
"SELECT max(ordering) FROM user_bookmark WHERE userid=$uid");
template.setParameters(Collections.singletonMap("uid",
user.getId()));
template.setFetchingDataRows(true);
List<UserBookmark> res = context.performQuery(template);
Integer maxOrdering = null;
if (res != null) {
Map row = (Map) res.get(0);
if (row != null) {
*maxOrdering = (Integer) row.get("max(ordering)"); // <==
ClassCastException*
}
}
return maxOrdering;
}
In my mapping file the user_bookmark is defined as
<db-entity name="user_bookmark">
<db-attribute name="bookmarkid" type="INTEGER" isMandatory="true"/>
<db-attribute name="id" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
<db-attribute name="ordering" type="INTEGER" isMandatory="true"/>
<db-attribute name="userid" type="INTEGER" isMandatory="true"/>
</db-entity>
Does this somehow relate to https://issues.apache.org/jira/browse/CAY-1354?
Why is row.get("max(ordering)") returning Byte?
Regards,
Borut
This archive was generated by hypermail 2.0.0 : Mon Oct 04 2010 - 15:51:50 UTC