V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Laysan
V2EX  ›  问与答

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

  •  
  •   Laysan · Nov 18, 2024 · 1226 views
    This topic created in 529 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   ·   2706 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 13:55 · PVG 21:55 · LAX 06:55 · JFK 09:55
    ♥ Do have faith in what you're doing.