๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

JAVA/MyBatis3

[Java] MyBatis xml ์ž‘์„ฑ Mapper - namespace : ์—ฌ๋Ÿฌ ๊ฐœ์˜ SQL๋ฌธ์„ ํŒจํ‚ค์ง€์ฒ˜๋Ÿผ ๋ฌถ๋Š”๋‹ค. SQL ํƒœ๊ทธ - ํƒœ๊ทธ๋ฅผ ์ œ๊ณต - ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ sql๋ฌธ์„ ๋ฏธ๋ฆฌ ์ •์˜ํ•ด ๋‘˜ ์ˆ˜ ์žˆ๋‹ค. SELECT #{S_ID} AS L_ID, F.L_NAME, F.L_TEACHER, F.L_PLACE, F.L_TIME, F.L_MAX FROM ${DB_LESSON}.FIRST_TYPE F WHERE F.L_ID = '11111' AND F.L_NAME NOT IN ( SELECT L_NAME FROM ${DB_LESSON}.FIRST_TYPE WHERE L_ID = #{S_ID} ) SELECT COUNT(*) FROM ( ) A parameterType - parameterType ์— ์ง€์ •๋œ ๊ฐ’์ด SQL๋ฌธ ์ž…๋ ฅ ๊ฐ’์œผ๋กœ ๋“ค์–ด๊ฐ„๋‹ค. resul.. 2023. 9. 18.
[JAVA] Spring์—์„œ Mybatis ์—ฐ๋™ Spring ํ™˜๊ฒฝ์—์„œ Mybatis - Mysql ์—ฐ๋™ํ•ด์„œ ๋กœ๊ทธ์ธ ํ”„๋กœ๊ทธ๋žจ ๋งŒ๋“ค๊ธฐ 1. Spring ์„ธํŒ… https://wz0z30.tistory.com/12 [Java] Spring ์ดˆ๊ธฐ ์„ธํŒ… (์ˆ˜๋™) 1. Maven Project ์ƒ์„ฑ ์นดํƒˆ๋กœ๊ทธ Internal ๋กœ ์„ค์ •ํ•œ ํ›„ web-app ์„ ํƒ Group id, Artifact id ์„ค์ • -> Finish C:\Users\user\eclipse-workspace\ํ”„๋กœ์ ํŠธ๋ช…\.settings ์— ์ ‘๊ทผ org.eclipse.jdt.core.prefs ํŒŒ์ผ.. wz0z30.tistory.com 2. pom.xml ์— ์˜์กด์„ฑ ์ฃผ์ž… (dependency) commons-dbcp commons-dbcp 1.4 mysql mysql-connector-java 8... 2021. 9. 24.
[JAVA] MyBatis ์‹œ์ž‘ํ•˜๊ธฐ (with Delegation Pattern) Mybatis ๋ž€? ์ž๋ฐ” ๊ฐ์ฒด์™€ SQL ์„ ์—ฐ๊ฒฐํ•ด์ฃผ๋Š” SQL ๋งคํผ ํ”„๋ ˆ์ž„์›Œํฌ์ด๋‹ค. JDBC ๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•ด์„œ ๊ฐœ๋ฐœํ•˜๋Š” ๊ฒƒ๊ณผ ๋‹ฌ๋ฆฌ SQL ๋ฌธ๊ณผ ์ž๋ฐ” ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ๊ตฌ๋ถ„ํ•ด์„œ ์ž‘์„ฑํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ€๋…์„ฑ์ด ๋†’๋‹ค. ์ž๋ฐ” ํŒŒ์ผ์ด ์•„๋‹Œ XML์— ์ฟผ๋ฆฌ๋ฌธ์„ ์ž‘์„ฑํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ฟผ๋ฆฌ๋ฌธ์ด ๋ณ€๊ฒฝ๋  ๋•Œ๋งˆ๋‹ค ์ปดํŒŒ์ผ์„ ํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ๋‹ค. 1. maven project ์ƒ์„ฑ, Mybatis dependency(pom.xml) ์ž‘์„ฑ 4.0.0 Mybatis01 Mybatis01 0.0.1-SNAPSHOT commons-dbcp commons-dbcp 1.4 mysql mysql-connector-java 8.0.26 org.mybatis mybatis 3.5.7 org.apache.maven.plugins maven-compil.. 2021. 9. 23.