๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

db3

[DB] GROUP BY ๊ฐ ๊ทธ๋ฃน์—์„œ ๋งˆ์ง€๋ง‰(์ตœ์‹ ) ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ GROUP BY๋Š” ์ง‘๊ณ„ ํ•จ์ˆ˜์˜ ๊ฒฐ๊ณผ๋ฅผ ํŠน์ • ์นผ๋Ÿผ ๊ธฐ์ค€์œผ๋กœ ๋ฌถ์–ด ์ถœ๋ ฅํ•ด์ฃผ๋Š” ์ฟผ๋ฆฌ์ธ๋ฐ GROUP BY๋ฅผ ํ•˜๊ฒŒ ๋˜๋ฉด ํŠน์ • ์นผ๋Ÿผ๊ณผ ์ง‘๊ณ„ ํ•จ์ˆ˜ ์™ธ์— ๋‹ค๋ฅธ ์ปฌ๋Ÿผ์€ ์กฐํšŒํ•  ์ˆ˜๊ฐ€ ์—†๋‹ค. PostgreSQL๊ฐ™์€ ๊ฒฝ์šฐ๋Š” ๋‹ค๋ฅธ ์นผ๋Ÿผ์„ ์กฐํšŒํ•˜๋ ค๊ณ  ํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. SQL Error [42803]: ์˜ค๋ฅ˜: column "test.id" ๋Š” ๋ฐ˜๋“œ์‹œ GROUP BY ์ ˆ๋‚ด์— ์žˆ์–ด์•ผ ํ•˜๋˜์ง€ ๋˜๋Š” ์ง‘๊ณ„ ํ•จ์ˆ˜ ๋‚ด์—์„œ ์‚ฌ์šฉ๋˜์–ด์ ธ์•ผ ํ•œ๋‹ค MySQL์€ GROUP BY์˜ ์นผ๋Ÿผ ์™ธ์—๋„ ์กฐํšŒ๊ฐ€ ๊ฐ€๋Šฅํ•˜์ง€๋งŒ ์ •ํ™•ํ•œ ๋ฐ์ดํ„ฐ๊ฐ€ ์•„๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ํŠน์ • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๊ตฌ์• ๋ฐ›์ง€ ์•Š์•„์•ผ ํ•œ๋‹ค. name ์นผ๋Ÿผ์„ group by ํ•˜์—ฌ ๋งˆ์ง€๋ง‰ ๋‚ ์งœ์˜ value๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•˜๊ณ ์ž ํ–ˆ๋‹ค. ๋ฐ์ดํ„ฐ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค. name๋ณ„ value์˜ ํ•ฉ๊ณ„๋Š” ๊ฐ„.. 2021. 12. 24.
[JPA] @OnDelete VS cascade = CascadeType.REMOVE ๊ด€๊ณ„ํ˜• DB์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” @OnDelete์™€ cascade = CascadeType.REMOVE์˜ ์ฐจ์ด๋ฅผ ์•Œ์•„๋ณด์ž! @OnDelete DDMS ๋ ˆ๋ฒจ์—์„œ ์ž‘๋™ @OnDelete(action = OnDeleteAction.CASCADE) DDL ์ƒ์„ฑ์‹œ cascade ์ œ์•ฝ ์กฐ๊ฑด์ด ์ƒ์„ฑ ๋จ. ์—ฌ๊ธฐ์„œ DDL์ด๋ž€ Data Definition Language๋กœ ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค๋ฅผ ์ •์˜ํ•˜๋Š” ์–ธ์–ด์ด๋ฉฐ, CREATE, ALTER, DROP, TRUNCATE๋ฅผ ๋งํ•œ๋‹ค. casecade=CascadeType.REMOVE JPA ๋ ˆ๋ฒจ์—์„œ ์ž‘๋™ JPA๊ฐ€ ๋ถ€๋ชจ ์—”ํ‹ฐํ‹ฐ๋ฅผ ์‚ญ์ œํ•  ๋•Œ ์—ฐ๊ด€๋œ ์ž์‹ ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•œ DELETE ์ฟผ๋ฆฌ๋ฅผ ์‹คํ–‰ ํ•จ ๋ณธ์ธ์˜ ๊ฒฝ์šฐ ๋ถ€๋ชจ์™€ ์ž์‹์˜ 1:N ๊ด€๊ณ„์ผ ๋•Œ ์•„๋ž˜ ์š”๊ตฌ์‚ฌํ•ญ์„ ์ถฉ์กฑ์‹œ์ผœ์•ผ ํ–ˆ๋‹ค. ์š”๊ตฌ.. 2021. 12. 13.
[Tomcat] JNDI ์ •๋ณด ์•”ํ˜ธํ™”(DB์ •๋ณด : url, username, passowrd) / KDF ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ด์šฉ 1. url, username, password๋ฅผ encrypt ํ•œ๋‹ค. KDFEncrypted.java import java.security.MessageDigest; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Hex; public class KDFEncrypted { public static void main(String[] args) { String key = "test"; String url = "jdbc:tibero:thin:@10.10.10.XX:XXXX:tibero"; St.. 2021. 11. 30.
728x90
๋ฐ˜์‘ํ˜•