[jboss-user] [JBoss Seam] - Upgrading from h3.1 to h3.2 : select count ClassCastExceptio

craig1980 do-not-reply at jboss.com
Wed Feb 7 09:27:18 EST 2007


Hi everybody.

I have an application developed under JBoss 4.0.1; in this AS there is hibernate3.1; i have used this version of hibernate for acceding to my DB; i have done a select count by using this sintax:


  | 	protected Query getQueryCount(BaseFilter filter) throws ValidateException, DaoException, IllegalParameterException {
  | .
  | .
  | .
  | 
  | String query = " select count(distinct tbasmusr.id) from TbaSmUsr tbasmusr where " +" tbasmusr.tbuSmUsrOus.size = 0 and tbasmusr.id != 0 ";
  | query = query + " and tbasmusr.id != " + idLogged ;
  | String nameUser = userFilter.getName();
  | 		
  | if( !PropertyValidator.isNullable( nameUser )){
  | 
  |  query = query + " and  ( tbasmusr.name like '%" + nameUser + "%' or tbasmusr.surname like '%" + nameUser + "%' or tbasmusr.socialName like '%" + nameUser + "%' )";
  | }
  | 		
  | String userType = userFilter.getUserType();
  | 		
  | if( !PropertyValidator.isNullable( userType )){
  |  query = query + " and tbasmusr.type like '" + userType+"'" ;
  | }
  | 		
  |  return  getSession().createQuery( query );
  | }
  | 

In the old version of Hibernate an Integer was returned by executing this quey; in the hibernate 3.2.0 (present in the AS Jboss 4.0.4) a Long is returned.....this causes a ClassCastException.... is this correct?
Why this change? Must i recompile all my code by adapting it to this change?

Thanks to all,
 Angelo.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4012440#4012440

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4012440



More information about the jboss-user mailing list