cassandra 获取int型数据问题

从cassandra数据库里查出来的数据在转型的时候总会报错 类似cassandra bigint <-> java.lang.Integer
实在不好搞所以想了个办法可能比较不好但是能用


    public List<PermissPos> findAllpermisspos() {
        Session session = cassBaseDao.getConnection();
        String cql="select * from szmb.authoritys";
        ResultSet results = session.execute(cql);
        List<PermissPos> perList= new ArrayList<PermissPos>(10);
        for (Row row : results) {
            PermissPos per = new PermissPos();
            String userName = row.getString("username");
            Map<String,String> perStr = row.getMap("authority",String.class, String.class);
            Object number = row.getObject("callnum");
            Integer num =   Integer.parseInt(number+"")  ;
            String role = row.getString("role");
            per.setUserName(userName);
            per.setCallNum(num);
            per.setPermissions(perStr);
            per.setRole(role);
            perList.add(per);
        }
        return perList;
    }

获取int型的时候
Object number = row.getObject(“callnum”);
Integer num = Integer.parseInt(number+”“) ;
先得到object再转型

你可能感兴趣的:(cassandra 获取int型数据问题)