MyBatis
MyBatisを利用していて、XML内の記述にstartDateTimeとendDateTimeの変数を指定しているところがある ... where INSERT_TIME between #{startDateTime} and #{endDateTime} ... Mapperのインターフェースは以下のように定義した @Mapper @Component interfac…
spring-bootでMyBatisを使っていて、MyBatisを利用する時だけ別のデータソースを利用したい場合にどうやるのかわかったのでメモ 元々1つのデータソースを利用する場合は以下のようにapplication.yamlでプロパティの定義をしていたのだが、 spring: datasour…
MyBatisで下のようなSELECT文の結果を、用意したクラスにマッピングしたい select user_id, user_name, hashed_password from some_table where id = #{id} この方法について調べた mybatis.org Result Maps Result Mapsを使うのが良さそう こんな感じで使う <select id="selectUsers" resultMap="userResultMap"></select>…
MyBatisを使っていて、あるマッピングファイルをみたときにSELECT文がで囲まれているのをみた <mapper namespace="com.example.domain.repository.todo.TodoRepository"> </mapper>