Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SpringBoot+MyBatisで例外が出たときどこを見るか
Search
syukai
March 27, 2024
Programming
0
260
SpringBoot+MyBatisで例外が出たときどこを見るか
syukai
March 27, 2024
Tweet
Share
More Decks by syukai
See All by syukai
ブランチ運用とデプロイフローを見直してリリースを楽にする
syukai
4
870
ノート付き-ブランチ運用とデプロイフローを見直してリリースを楽にする
syukai
0
61
TypeScriptとテストをはじめた
syukai
0
1k
一歩ずつ進めるVue.js
syukai
2
390
kanjava20170326
syukai
0
550
Other Decks in Programming
See All in Programming
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
330
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
230
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
240
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
受け取る人から提供する人になるということ
little_rubyist
0
240
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Jakarta EE meets AI
ivargrimstad
0
650
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
CSC509 Lecture 11
javiergs
PRO
0
180
Featured
See All Featured
Designing for humans not robots
tammielis
250
25k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Building Applications with DynamoDB
mza
90
6.1k
Git: the NoSQL Database
bkeepers
PRO
427
64k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Statistics for Hackers
jakevdp
796
220k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
A better future with KSS
kneath
238
17k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
GraphQLとの向き合い方2022年版
quramy
43
13k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Transcript
4QSJOH .Z#BUJTͰ ྫ֎͕ग़ͨͱ͖Ͳ͜ΛݟΔ͔ ؔδϟό`݄ ϢΧΠ
ϢΧΠ !TZVLBJ &$αΠτ։ൃӡ༻νʔϜͷ&. +BWBΛத৺ʹஔ͖ͭͭ։ൃʹؔ͢ΔͳΜͰΔ ʢϑϩϯτΤϯυ͔ΒڑΛஔ͍͍ͯΔʣ ࣗݾհ 2
ࠓͷΰʔϧ w .Z#BUJTͷΤϥʔݟͯύχΫΒͳ͍
.Z#BUJTͱʁ IUUQTNZCBUJTPSHNZCBUJTKBJOEFYIUNM
ࡶͳઆ໌ 9.-ϑΝΠϧʹॻ͍ͨ42-Λ࣮ߦͯ͘͠ΕΔπʔϧ ʢͱ͍͏͍ํΛ͢ΔఆͰࠓ͠·͢ʣ
ͱ͍͏ཧղͩͱྫ֎ग़ͨͱ͖ʹʮ42-࣮ߦ͍͚ͨͩ͠ͳͷʹʂʯͱͳΔ ݴ͍͑Δͱ ʮ42-Λ࣮ߦ͢ΔͨΊʹඞཁͳz͋Ε͜Εzͬͯ͘ΕΔศརͳͭʯ ˠz͋Ε͜Εz͕ͲΜͳ͜ͱͳͷ͔͓ͬͯ͘͜ͱ͕େࣄ ˠ͜ͷล͕ؒҧ͑ͯͨΒ͜Μͳྫ֎͕ग़Δɺ͕Θ͔Δ ɹυΩϡϝϯτͪΐͬͱಡΈ͘͢ͳΔͣʢͨͿΜɻ͠ΒΜ͚Ͳʣ
େ·͔ͳॲཧͷྲྀΕ
ʢલఏʣࠓճఆͷڥ w +BWB w 4QSJOH#PPU w )%BUBCBTF w (SBEMF ˞ڥҎ֎ʹҧ͏͍ํɾॻ͖ํͰ͖·͕͢ɺ
ɹҰྫͱͯ͠ࢀߟʹ͍ͯͩ͘͠͞ɻ
αϯϓϧ ݺͼग़͠Օॴ demoMapper.get(); %FNP.BQQFSKBWB @Mapper public interface DemoMapper { List<Demo>
get();_ } %FNP.BQQFSYNM <select id="get"> SELECT * FROM demo </select> (JU)VCIUUQTHJUIVCDPNTZVLBJNZCBUJTFSSPSMFBSOJOHXJUITQSJOHCPPU
ͬͯ͘ΕΔ͜ͱ ʢΞϓϦىಈ࣌ʣ9.-Λϩʔυ .BQϑΝΠϧΛ୳͢ ύϥϝλ͢ɺΓͷϚοϐϯά 42-Λ४උ͢Δ QSFQBSF
42-Λ࣮ߦͯ͠%#͔Β݁ՌΛड͚औΔ ΦϒδΣΫτʹΛೖ ͦΕͧΕͷॲཧͰΤϥʔ͕ൃੜ͠͏Δ ίϯύΠϧΤϥʔʹͳΒͳ͍
9.-ϑΝΠϧΛϩʔυ w ىಈ࣌ʹ.Z#BUJT༻ʹ༻ҙͨ͠9.-ϑΝΠϧΛϩʔυ͢Δ w 9.-ΛಡΈࠐΜͰඞཁͳΫϥεͱ͔ϩʔυͯ͠Δʁ
ൃੜ͢Δྫ֎ͱz͋Δ͋Δz w PSHBQBDIFJCBUJTCVJMEFS#VJMEFS&YDFQUJPOʢىಈ࣌ʹൃੜʣ w 9.-ͷจ๏͕ؒҧ͑ͯΔ w 3FTVMU.BQͳͲʹࢦఆͨ͠Ϋϥε͕ؒҧ͑ͯΔʢଘࡏ͠ͳ͍ʣ
.BQϑΝΠϧΛ୳͢ w .BQQFSΠϯλϑΣʔεʹରԠ͢ΔYNMϑΝΠϧΛ୳͢ w σϑΥϧτͰSFTPVSDFTԼͷ.BQQFSͱಉ͡ύε w .BQQFS͕TSDNBJODPNFYBNQMFEFNP.BQQFSͳΒ SFTPVSDFNBJODPNFYBNQMFEFNP.BQQFSYNM w
.BWFO(SBEMFͰSFTPVSDFTͷରΛઃఆ͢Δ͜ͱͰNBJOԼʹஔ͍ ͯಡΈࠐ·ΕΔΑ͏ʹมߋͰ͖Δ
ൃੜ͢Δྫ֎ͱz͋Δ͋Δz w PSHBQBDIFJCBUJTCJOEJOH#JOEJOH&YDFQUJPO w ϑΝΠϧͷஔ͖ॴؒҧ͑ͯΔ w ϑΝΠϧ໊ʢେจࣈখจࣈͱؚ͔Ίʣؒҧ͑ͯΔ w 3FTPVSDFͷઃఆ͕ແ͍ɺؒҧ͑ͯΔ
ύϥϝλΛ͢ w 42-ͰόΠϯυมͱͯ͠ѻ͏Λ͢ w .BQQFSϝιουͷύϥϝλʹ!1BSBNΞϊςʔγϣϯΛ͚ͭͯύϥϝλ Λ͢ Demo getById(@Param("pk") DemoPk pk);
w 42-ଆͰ\YYY^ \YYY^ͳͲͰύϥϝλΛड͚औΔ where pk = #{pk.value}
ൃੜ͢Δྫ֎ͱz͋Δ͋Δz w PSHNZCBUJTTQSJOH.Z#BUJT4ZTUFN&YDFQUJPO w DBVTFECZPSHBQBDIFJCBUJTCJOEJOH#JOEJOH&YDFQUJPO w .BQQFSͱ9.-Ͱύϥϝλ໊͕Ұகͯ͠ͳ͍ w ύϥϝλ໊ॻ͖Ε w
!1BSBNॻ͖Ε
ൃੜ͢Δྫ֎ͱz͋Δ͋Δz w PSHNZCBUJTTQSJOH.Z#BUJT4ZTUFN&YDFQUJPO w DBVTFECZPSHBQBDIFJCBUJTSF fl FDUJPO3F fl FDUJPO&YDFQUJPO w
ϓϩύςΟ͕ͳ͍ w ϓϩύςΟ໊ؒҧ͑ͯΔʢେจࣈɾখจࣈʣ w ϓϩύςΟͷ֊Λؒҧ͑ͯΔ
݁ՌΛϚοϐϯά w %#͔Βड͚औͬͨ݁ՌΛฦ٫༻ΫϥεʹϚοϐϯά͢Δ w ͜ͷྻ͜ͷϓϩύςΟʹೖΕΔͱ͔ w SFTVMU5ZQFSFTVMU.BQͷࢦఆ w SFTVMU.BQͰྻຖͷϚοϐϯάࢦఆ
ൃੜ͢Δྫ֎ͱz͋Δ͋Δz w PSHNZCBUJTTQSJOH.Z#BUJT4ZTUFN&YDFQUJPO w DBVTFECZPSHBQBDIFJCBUJTSF fl FDUJPO3F fl FDUJPO&YDFQUJPO w
ϓϩύςΟ໊ؒҧ͑ͯΔ
ൃੜz͠ͳ͍zΤϥʔ w 4FMFDUͯ͠ͳ͍ྻ໊Λॻ͍͍ͯͯΤϥʔʹͳΒͳ͍ w ࣮ߦͯ֘͠ͷ߲ʹOVMMίϯετϥΫλͷॳظ͕ೖΔ͚ͩ w +BWBͰೖΕ༻ҙ͚ͨ͠ͲԿೖΒͳ͔ͬͨɺΈ͍ͨͳѻ͍
42-Λ४උ͢Δ w ࣮ߦͷલʹ42-ΛϓϦίϯύΠϧ࣮ͯ͠ߦ४උ͢Δ w .Z#BUJTʹݶΒ͍͍ͣͩͨ͜ͷॲཧ͕͋Δ w ࢀߟKBWBTRM1SFQBSFE4UBUFNFOU
ൃੜ͢Δྫ֎ͱz͋Δ͋Δz w จ๏Τϥʔ͜ͷλΠϛϯάͩͱࢥͬͯͨΜ͚ͩͲ ࠓճΑ͘Α֬͘ೝͨ͠Βҧ͏͔ͬͨʂ w ͜ͷλΠϛϯάͰΤϥʔى͜͢ํ๏ࢥ͍͔ͭͳ͔ͬͨͷͰ͍͖࣍·͢ʂ
42-࣮ߦͯ͠%#͔Β݁ՌΛड͚औΔ w ࣮ࡍʹ42-Λ࣮ߦ͢Δ w %BUBTPVSDFΛࢀরͯ͠%#ʹଓ w ଓࣗମ.Z#BUJTͷൣғ֎ʢ)JLBSJ$1ͱ͔ʣ w ݁ՌΛ%#͔Βड͚औΔ w
ਖ਼ৗͳͷ͔ɺҟৗͳͷ͔ w ड͚औͬͨ݁ՌΛݺͼग़͠ݩʹฦ٫Ͱ͖Δܗʹ͢Δͷ͜ͷޙͷॲཧɻ
ൃੜ͢Δྫ֎ͱz͋Δ͋Δz w %#ʹͭͳ͕Βͳ͍ɺ%#མͪͯͨɺλΠϜΞτɾɾɾ w ʢଂ)Ͱ͜ͷλΠϛϯάͰى͜͢ͷ͘͠ͳ͍ʁʣ w PSHTQSJOHGSBNFXPSLKECD#BE4RM(SBNNBS&YDFQUJPO w 42-จ๏ޡΓ w
UZQPɺ4&-&$5۟ͷΧϯϚൈ͚ɺςʔϒϧ໊ɾྻ໊ؒҧ͍ɾɾɾɾ
ΦϒδΣΫτʹΛೖ w %#͔Βड͚औͬͨ݁ՌΛ+BWBͷΦϒδΣΫτʹ֨ೲ͢Δ w ֨ೲ͢ΔͨΊͷΠϯελϯεੜ w SFTVMU.BQ͕͋ΕهࡌͷϚοϐϯάͰɺ ͳ͚Εྻ໊ʹԊͬͨϓϩύςΟʹSF fl
FDUJPOͰΛ֨ೲ
ൃੜ͢Δྫ֎ͱz͋Δ͋Δz w PSHNZCBUJTTQSJOH.Z#BUJT4ZTUFN&YDFQUJPO w $BVTFECZPSHBQBDIFJCBUJTSF fl FDUJPO3F fl FDUJPO&YDFQUJPO w
֨ೲ͢ΔΫϥεʹదͳίϯετϥΫλ͕ແ͍ w Ҿͳ͠ίϯετϥΫλ͔ɺ֨ೲ͢Δશ߲ͷҾΛ࣋ͭίϯετϥ Ϋλ͕ଥ w QSJWBUFͰେৎ w ίϯετϥΫλະఆٛͳΒσϑΥϧτͰҾͳ͕͠༻ҙ͞ΕΔ
͓·͚ɿͨ·ʹz͋Δ͋Δz w ίϯετϥΫλϓϩύςΟͪΌΜͱ͋ΔͷʹͳΜ͔͕͏·͍͜ͱ ೖΒͳ͍ͷͳΜͰʁʁʁ w ಛఆͷQSF fi Y͕͍ͭͨϝιου͕HFUUFSTFUUFSͱͯ͠ಈ͍ͯ͠·͏ w HFU
JT DBOʜ w HFU)PHF \JG IPHFOVMM SFUVSOOFX)PHF ^
ྫʣ )PHF\ 'VHBGVHBOFX'VHB )PHF \^ HFU'VHB \ JG GVHBWBMVFOVMM
SFUVSOOFX'VHB SFUVSOGVHB ^ ίϯετϥΫλʹΑΓGVHBOVMMͷ )PHFΠϯελϯε͕࡞ΒΕΔ .Z#BUJTGVHBʹೖ͢ΔͨΊ HFU'VHBͰऔΓग़ͨ͠ϓϩύςΟʹ Λೖ͠Α͏ͱ͢Δ GVHBOVMMͳͷͰ৽͍͠'VHBΠϯ ελϯε͕ฦ͞ΕΔ ̏Ͱ࡞ͬͨΠϯελϯεʹΛೖ )PHFGVHBOVMMͷ··ɾɾɾ )PHF GVHB OVMM GVHB HFU'VHB ೖ
͍͞͝ʹ w ࠓճհͨ͠Ҏ֎ʹ৭ΜͳΤϥʔ͕ൃੜ͠ಘΔ w ͲΜͳ͜ͱΛͲΜͳॱ൪Ͱ͍ͬͯΔͷ͔ΛѲ͠ͳ͕Β ʮ42-࣮ߦͰ͖ͯΔ͔Β͜ͷล͕ؒҧ͑ͯͦ͏ʯ ʮ42-ͷ࣮ߦ͢Βͯ͠ͳ͍͔Β͜͜Βล͔ΒௐΑ͏ʯ
ͱ͔མͪண͍ͯߟ͑ΒΕΔΑ͏ʹͳΔͱخ͍͠Ͱ͢ʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ