FAQ
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

@SuppressWarnings("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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedOct 4, '10 at 3:51p
activeOct 4, '10 at 3:51p
posts1
users1
websitecayenne.apache.org

1 user in discussion

Borut Bolčina: 1 post

People

Translate

site design / logo © 2022 Grokbase