Laysan
V2EX  ›  问与答

Mysql 中 TinyInt 和 Java 中的 bool 对象转换问题

  •  
  •   Laysan · Nov 18, 2024 · 1263 views
    This topic created in 545 days ago, the information mentioned may be changed or developed.

    背景

    表中有个字段是 active tinyint(1) not null, 数据库中的数据存储的是 1.对应的 java 字段是 boole active;

    问题

    在某些特殊情况下通过 ibatis 查询出来的数据 active=false.具体原因不明,大部分情况得到的结果是 active=true.

    问题点

    理论上 tinyint=1 是 true,无法定位 为啥 拿到的 java 值是 false.

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4832 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 09:51 · PVG 17:51 · LAX 02:51 · JFK 05:51
    ♥ Do have faith in what you're doing.