わいえむねっと

Contents
Categories
Calendar
2023/03
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Monthly Archives
~2000/01
Recent Entries
RSS1.0
Templates
Information
Processed: 0.023 sec
Chashed: -
2023/03/17 Fri
MyBatisGenerator で BLOB を含むテーブルのマッパーを生成したけど、肝心の BLOB が取得できないと相談されて、試しに selectByPrimaryKey したら普通に取れて「?」と思ったけど、selectByExample だとダメということらしい。

なんでだと思いながら生成されたマッパー見てみたら、BLOB を返す selectByExampleWithBLOBs が別に出力されてて、selectByExample では除外するようになってた。
複数行を返却する selectByExample の場合は、サイズの大きい可能性のある BLOB を常に返さないよう、選択できるようにしてたのか。
BLOB を含むテーブルで使ったことなく知らなんだ。


MyBatis Generator Core – MyBatis Generator Generated Java Client Objects
https://mybatis.or​g/generator/generatedo​bjects/javaclient​.html
MBG attempts to make it easier to deal with tables that contain BLOBs by generating different objects and methods so that you can use the BLOB fields, or ignore them, depending on the situation.