Posts
Q&A
์ฌ์ํ ๋ด์ฉ ํ์ธ ๋ถํ๋๋ฆฝ๋๋ค!
ํ ๋ฒ๊ฐ๊ฐ์ด ํ์ธํด์ฃผ์ ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
- 0
- 2
- 237
Q&A
Collection type์ผ๋ก Set ๋์ List๋ฅผ ์ฌ์ฉํ๋ ์ด์ ๊ฐ ์๋์ง์?
๋ง์ํด์ฃผ์ ๋ด์ฉ์ ํ์ธํด๋ณธ ๊ฒฐ๊ณผ๋ก, ํน์ ์ฐพ์์ค์ ๋ถ๋ค๊ป ๋์์ด ๋ ๊น ์ถ์ด ๊ณต์ ํฉ๋๋ค.๊ฒฐ๋ก ์ ์ผ๋ก๋ ๋ง์ํด์ฃผ์ ๋๋ก (์๋ฐฉํฅ ์ฐ๊ด๊ด๊ณ + List)๋ฅผ ์ทจํ๋ฉด ๋ถํ์ํ fetch๊ฐ ์์ ๊ฒ ๊ฐ์ต๋๋ค.1. ๊ฐ ํ์ ์ Collection์ ๋ณ๊ฒฝ์ํฌ ๊ฒฝ์ฐ ๋ง์๋๋ก Set์์๋ ๋ฐ์ดํฐ๊ฐ ๋ก๋ฉ๋๊ณ List์์๋ ๋ฐ์ดํฐ๊ฐ ๋ก๋ฉ๋์ง ์์์ ํ์ธํ์์ต๋๋ค.2. ๋ฐ๋ฉด 1:N ๋จ๋ฐฉํฅ ์ฐ๊ด๊ด๊ณ์์๋ Collection์ ๋ณ๊ฒฝ์ํฌ ๊ฒฝ์ฐ Set, List ๋ชจ๋ ๋ฐ์ดํฐ๊ฐ ๋ก๋ฉ๋จ์ ํ์ธํ์์ต๋๋ค.(์ถ๊ฐ)3. ์ฐ๋ฆฌ๊ฐ N:1 ์๋ฐฉํฅ ์ฐ๊ด๊ด๊ณ์ mappedBy์์๋ Set์์๋ง ๋ฐ์ดํฐ๊ฐ ๋ก๋ฉ๋๋ค๋ ๋ด์ฉ์ Documentation์ ์ฐพ๊ณ ํ์ธํ์์ต๋๋ค.๋ค๋ง ํด๋น ์๋ฃ๋ ์ต๊ทผ ๋ฒ์ ์์ ์์ด์ง๊ฑฐ๋ ์ด๋ํ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค.์๋ ๋ฒ์ (Hibernate 4.3): https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch20.html#performance-collections-mostefficientupdate์ต๊ทผ ๋ฒ์ (Hibernate 5.4): https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#best-practices-mapping-associations=====2022/05/29 ์์ - Github Gist๋ก ๊ด๋ จ ํ์ผ๋ง ์ฎ๊ฒผ์ต๋๋ค.์ ๊ฐ ์ฌ์ฉํ ์ฝ๋์ ๋๋ค (https://gist.github.com/nightlyherb/00447a2ab196dcc3d5cd9e9b01f313ef)๊ด๋ จ ๋ถ๋ถDemoRunner.java๊ฒฐ๊ณผ===== Init Lazy Parent ===== Hibernate: select parent0_.id as id1_1_0_ from parent parent0_ where parent0_.id=? ===== Embeddable Child Set ===== Hibernate: select embeddable0_.parent_id as parent_i1_2_0_, embeddable0_.value as value2_2_0_ from parent_embeddable_child_list embeddable0_ where embeddable0_.parent_id=? ===== Embeddable Child List ===== ===== Entity Child Set ===== Hibernate: select entitychil0_.set_parent_id as set_pare2_0_0_, entitychil0_.id as id1_0_0_, entitychil0_.id as id1_0_1_ from entity_child entitychil0_ where entitychil0_.set_parent_id=? ===== Entity Child List ===== Hibernate: select entitychil0_.list_parent_id as list_par3_0_0_, entitychil0_.id as id1_0_0_, entitychil0_.id as id1_0_1_ from entity_child entitychil0_ where entitychil0_.list_parent_id=? ===== Bidirectional Mapping Child Set ===== Hibernate: select bidirectio0_.set_parent_id as set_pare3_0_0_, bidirectio0_.id as id1_0_0_, bidirectio0_.id as id1_0_1_, bidirectio0_.list_parent_id as list_par2_0_1_, bidirectio0_.set_parent_id as set_pare3_0_1_ from bidirectional_mapping_child bidirectio0_ where bidirectio0_.set_parent_id=? ===== Bidirectional Mapping Child List ===== ===== End ===== (๊ทธ ํ Embeddable Child List์ ํ ์ด๋ธ ์ ๋ถ ๋ ๋ฆฌ๊ณ ๋ค์ insertํ๋ ์ฟผ๋ฆฌ ์ํ)
- 11
- 4
- 2.5K
Q&A
Collection type์ผ๋ก Set ๋์ List๋ฅผ ์ฌ์ฉํ๋ ์ด์ ๊ฐ ์๋์ง์?
์ ๋ง ์๊ฐ์ง๋ ๋ชปํ ๋ฌธ์ ๊ฐ ์์๋ค์! ๋ต๋ณ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
- 11
- 4
- 2.5K
Q&A
์ฝ๋ ๋ณต์ฌ ๊ฐ๋ฅํ ์๋ฃ
๊น๋ํ๊ฒ ์ ๋ ฌ๋ jumbotron-narrow.css๋ ์ฌ๊ธฐ์์ ๋ฐ์ผ์ค ์ ์์ต๋๋ค:https://getbootstrap.com/docs/3.4/examples/jumbotron-narrow/jumbotron-narrow.css
- 2
- 3
- 439
Q&A
foreach ๋จ์ถํค
์ง๋๊ฐ์๋ ๋ถ๋ค์ ์ํด ๋งฅ๋ฝ์ ์ ์๋ฉด ๊ฐ์ 3:30์ ๋์ค๋ ๋ด์ฉ์ด๊ณ ์ฐ๊ด๋ ๋จ์ถํค๋ก orderItems.for (iter๊ณผ ๋์ผ) / orderItems.fori / orderItems.forr ๋ฑ์ด ์๋ค์
- 4
- 2
- 305
Q&A
์ํฐํฐ ๊ธฐ๋ณธ ์์ฑ์๋ฅผ protected๋ก ํ์ ๋ ํ ์คํธ ์ง๋ฌธ
์ ์ ๋ง ๊ฐ์ฌ๋๋ฆฝ๋๋ค ใ ใ
- 0
- 2
- 1K