java.math.BigInteger cannot be cast to java.lang.Long

前端 未结 8 722
醉话见心
醉话见心 2020-12-09 15:44

I\'ve got List dynamics. And I want to get max result using Collections. This is my code:

List dynamics=spy         


        
8条回答
  •  悲哀的现实
    2020-12-09 15:58

    You need to add an alias for the count to your query and then use the addScalar() method as the default for list() method in Hibernate seams to be BigInteger for numeric SQL types. Here is an example:

    List sqlResult = session.createSQLQuery("SELECT column AS num FROM table")
        .addScalar("num", StandardBasicTypes.LONG).list();
    

提交回复
热议问题