Home  >  Q&A  >  body text

java.lang.Long cannot be cast to java.lang.Integer

PHP中文网PHP中文网2741 days ago462

reply all(3)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 10:14:57

    What database are you using?
    You replace the parameter (long id) with (Integer id).
    The reason why this error is reported is that the type conversion failed.
    The long type cannot be converted to the Integer type.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:14:57

    You can convert the id to Integer in the method and then put it into the dc,

    String str = id.toString();
    Integer id1 = Integer.valueOf(str);
    or Integer id1 = new Integer(str);

    reply
    0
  • PHPz

    PHPz2017-04-18 10:14:57

    If you really want to force transfer, first long转成string,然后stringinteger

    reply
    0
  • Cancelreply