[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5273) RowCountProjection long to int cast exception
Pamir Erdem (JIRA)
noreply at atlassian.com
Fri May 28 08:06:57 EDT 2010
RowCountProjection long to int cast exception
---------------------------------------------
Key: HHH-5273
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5273
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.2
Environment: hibernate-core 3.5.2
Reporter: Pamir Erdem
After we upgraded our hibernate.jar from 3.3.2 to 3.5.2 the methods which executes rowcount functions have started to throw long to cast exception.
>From the source code of hibernate, it is clear that for the features which will be implemented in 3.6
some implementations are changed.
#http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
In 3.3.2
{code:title=RowCountProjection.java|borderStyle=solid}
public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
return new Type[] { Hibernate.INTEGER };
}
{code}
In 3.5.2
{code:title=RowCountProjection.java|borderStyle=solid}
return new Type[] {
getFunction( criteriaQuery ).getReturnType( null, criteriaQuery.getFactory() )
};
{code}
But the definitions of the rowcount functions in both versions in same in Dialect.java
{code}
static {
STANDARD_AGGREGATE_FUNCTIONS.put(
"count",
new StandardSQLFunction("count") {
public Type getReturnType(Type columnType, Mapping mapping) {
return Hibernate.LONG;
}
public String render(List args, SessionFactoryImplementor factory) {
if ( args.size() > 1 ) {
if ( "distinct".equalsIgnoreCase( args.get( 0 ).toString() ) ) {
return renderCountDistinct( args );
}
}
return super.render( args, factory );
}
{code}
By this minor change in 3.5.2 all the project tests which executes count sql function are failing by throwing class cast exception
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list