묻고 답해요
141만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
주문 취소 Cancel 버튼이 작동하지 않음
주문 취소 기능을 가진 cancel 버튼을 클릭해도 주문 취소 상태로 변하지 않습니다. 무엇이 문제일까요? cancel 버튼 누를 시 콘솔 2022-01-28 09:45:17.700 DEBUG 7444 --- [nio-8080-exec-4] org.hibernate.SQL : select order0_.order_id as order_id1_6_0_, order0_.delivery_id as delivery4_6_0_, order0_.member_id as member_i5_6_0_, order0_.order_date as order_da2_6_0_, order0_.status as status3_6_0_ from orders order0_ where order0_.order_id=? 2022-01-28 09:45:17.700 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [3] 2022-01-28 09:45:17.702 INFO 7444 --- [nio-8080-exec-4] p6spy : #1643330717702 | took 1ms | statement | connection 18| url jdbc:h2:tcp://localhost/~/jpashop select order0_.order_id as order_id1_6_0_, order0_.delivery_id as delivery4_6_0_, order0_.member_id as member_i5_6_0_, order0_.order_date as order_da2_6_0_, order0_.status as status3_6_0_ from orders order0_ where order0_.order_id=? select order0_.order_id as order_id1_6_0_, order0_.delivery_id as delivery4_6_0_, order0_.member_id as member_i5_6_0_, order0_.order_date as order_da2_6_0_, order0_.status as status3_6_0_ from orders order0_ where order0_.order_id=3; 2022-01-28 09:45:17.703 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([delivery4_6_0_] : [BIGINT]) - [4] 2022-01-28 09:45:17.703 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([member_i5_6_0_] : [BIGINT]) - [1] 2022-01-28 09:45:17.704 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_da2_6_0_] : [TIMESTAMP]) - [2022-01-28T09:43:00.843051] 2022-01-28 09:45:17.704 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([status3_6_0_] : [VARCHAR]) - [ORDER] 2022-01-28 09:45:17.706 TRACE 7444 --- [nio-8080-exec-4] org.hibernate.type.CollectionType : Created collection wrapper: [jpabook.jpashop.domain.Order.orderItems#3] 2022-01-28 09:45:17.707 DEBUG 7444 --- [nio-8080-exec-4] org.hibernate.SQL : select delivery0_.delivery_id as delivery1_2_0_, delivery0_.city as city2_2_0_, delivery0_.street as street3_2_0_, delivery0_.zipcode as zipcode4_2_0_, delivery0_.status as status5_2_0_ from delivery delivery0_ where delivery0_.delivery_id=? 2022-01-28 09:45:17.708 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [4] 2022-01-28 09:45:17.710 INFO 7444 --- [nio-8080-exec-4] p6spy : #1643330717710 | took 0ms | statement | connection 18| url jdbc:h2:tcp://localhost/~/jpashop select delivery0_.delivery_id as delivery1_2_0_, delivery0_.city as city2_2_0_, delivery0_.street as street3_2_0_, delivery0_.zipcode as zipcode4_2_0_, delivery0_.status as status5_2_0_ from delivery delivery0_ where delivery0_.delivery_id=? select delivery0_.delivery_id as delivery1_2_0_, delivery0_.city as city2_2_0_, delivery0_.street as street3_2_0_, delivery0_.zipcode as zipcode4_2_0_, delivery0_.status as status5_2_0_ from delivery delivery0_ where delivery0_.delivery_id=4; 2022-01-28 09:45:17.710 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([city2_2_0_] : [VARCHAR]) - [qq] 2022-01-28 09:45:17.710 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([street3_2_0_] : [VARCHAR]) - [qq] 2022-01-28 09:45:17.710 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([zipcode4_2_0_] : [VARCHAR]) - [11111] 2022-01-28 09:45:17.711 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([status5_2_0_] : [VARCHAR]) - [null] 2022-01-28 09:45:17.711 DEBUG 7444 --- [nio-8080-exec-4] org.hibernate.SQL : select orderitems0_.order_id as order_id5_5_0_, orderitems0_.order_item_id as order_it1_5_0_, orderitems0_.order_item_id as order_it1_5_1_, orderitems0_.count as count2_5_1_, orderitems0_.item_id as item_id4_5_1_, orderitems0_.order_id as order_id5_5_1_, orderitems0_.order_price as order_pr3_5_1_ from order_item orderitems0_ where orderitems0_.order_id=? 2022-01-28 09:45:17.712 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [3] 2022-01-28 09:45:17.713 INFO 7444 --- [nio-8080-exec-4] p6spy : #1643330717713 | took 0ms | statement | connection 18| url jdbc:h2:tcp://localhost/~/jpashop select orderitems0_.order_id as order_id5_5_0_, orderitems0_.order_item_id as order_it1_5_0_, orderitems0_.order_item_id as order_it1_5_1_, orderitems0_.count as count2_5_1_, orderitems0_.item_id as item_id4_5_1_, orderitems0_.order_id as order_id5_5_1_, orderitems0_.order_price as order_pr3_5_1_ from order_item orderitems0_ where orderitems0_.order_id=? select orderitems0_.order_id as order_id5_5_0_, orderitems0_.order_item_id as order_it1_5_0_, orderitems0_.order_item_id as order_it1_5_1_, orderitems0_.count as count2_5_1_, orderitems0_.item_id as item_id4_5_1_, orderitems0_.order_id as order_id5_5_1_, orderitems0_.order_price as order_pr3_5_1_ from order_item orderitems0_ where orderitems0_.order_id=3; 2022-01-28 09:45:17.713 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_it1_5_1_] : [BIGINT]) - [5] 2022-01-28 09:45:17.714 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([count2_5_1_] : [INTEGER]) - [3] 2022-01-28 09:45:17.714 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([item_id4_5_1_] : [BIGINT]) - [2] 2022-01-28 09:45:17.714 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_id5_5_1_] : [BIGINT]) - [3] 2022-01-28 09:45:17.714 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_pr3_5_1_] : [INTEGER]) - [1111] 2022-01-28 09:45:17.714 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_id5_5_0_] : [BIGINT]) - [3] 2022-01-28 09:45:17.714 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_it1_5_0_] : [BIGINT]) - [5] 2022-01-28 09:45:17.715 DEBUG 7444 --- [nio-8080-exec-4] org.hibernate.SQL : select item0_.item_id as item_id2_3_0_, item0_.name as name3_3_0_, item0_.price as price4_3_0_, item0_.stock_quantity as stock_qu5_3_0_, item0_.artist as artist6_3_0_, item0_.etc as etc7_3_0_, item0_.author as author8_3_0_, item0_.isbn as isbn9_3_0_, item0_.actor as actor10_3_0_, item0_.director as directo11_3_0_, item0_.dtype as dtype1_3_0_ from item item0_ where item0_.item_id=? 2022-01-28 09:45:17.716 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [2] 2022-01-28 09:45:17.717 INFO 7444 --- [nio-8080-exec-4] p6spy : #1643330717717 | took 0ms | statement | connection 18| url jdbc:h2:tcp://localhost/~/jpashop select item0_.item_id as item_id2_3_0_, item0_.name as name3_3_0_, item0_.price as price4_3_0_, item0_.stock_quantity as stock_qu5_3_0_, item0_.artist as artist6_3_0_, item0_.etc as etc7_3_0_, item0_.author as author8_3_0_, item0_.isbn as isbn9_3_0_, item0_.actor as actor10_3_0_, item0_.director as directo11_3_0_, item0_.dtype as dtype1_3_0_ from item item0_ where item0_.item_id=? select item0_.item_id as item_id2_3_0_, item0_.name as name3_3_0_, item0_.price as price4_3_0_, item0_.stock_quantity as stock_qu5_3_0_, item0_.artist as artist6_3_0_, item0_.etc as etc7_3_0_, item0_.author as author8_3_0_, item0_.isbn as isbn9_3_0_, item0_.actor as actor10_3_0_, item0_.director as directo11_3_0_, item0_.dtype as dtype1_3_0_ from item item0_ where item0_.item_id=2; 2022-01-28 09:45:17.717 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([dtype1_3_0_] : [VARCHAR]) - [B] 2022-01-28 09:45:17.718 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([name3_3_0_] : [VARCHAR]) - [add] 2022-01-28 09:45:17.719 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([price4_3_0_] : [INTEGER]) - [1111] 2022-01-28 09:45:17.719 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([stock_qu5_3_0_] : [INTEGER]) - [1108] 2022-01-28 09:45:17.719 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([author8_3_0_] : [VARCHAR]) - [dffdsf] 2022-01-28 09:45:17.719 TRACE 7444 --- [nio-8080-exec-4] o.h.type.descriptor.sql.BasicExtractor : extracted value ([isbn9_3_0_] : [VARCHAR]) - [3432423] 2022-01-28 09:45:17.720 TRACE 7444 --- [nio-8080-exec-4] org.hibernate.type.CollectionType : Created collection wrapper: [jpabook.jpashop.domain.item.Item.categories#2] 2022-01-28 09:45:17.722 INFO 7444 --- [nio-8080-exec-4] p6spy : #1643330717722 | took 0ms | commit | connection 18| url jdbc:h2:tcp://localhost/~/jpashop ; 2022-01-28 09:45:17.749 DEBUG 7444 --- [nio-8080-exec-3] org.hibernate.SQL : select order0_.order_id as order_id1_6_, order0_.delivery_id as delivery4_6_, order0_.member_id as member_i5_6_, order0_.order_date as order_da2_6_, order0_.status as status3_6_ from orders order0_ inner join member member1_ on order0_.member_id=member1_.member_id limit ? 2022-01-28 09:45:17.750 INFO 7444 --- [nio-8080-exec-3] p6spy : #1643330717750 | took 0ms | statement | connection 19| url jdbc:h2:tcp://localhost/~/jpashop select order0_.order_id as order_id1_6_, order0_.delivery_id as delivery4_6_, order0_.member_id as member_i5_6_, order0_.order_date as order_da2_6_, order0_.status as status3_6_ from orders order0_ inner join member member1_ on order0_.member_id=member1_.member_id limit ? select order0_.order_id as order_id1_6_, order0_.delivery_id as delivery4_6_, order0_.member_id as member_i5_6_, order0_.order_date as order_da2_6_, order0_.status as status3_6_ from orders order0_ inner join member member1_ on order0_.member_id=member1_.member_id limit 1000; 2022-01-28 09:45:17.750 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_id1_6_] : [BIGINT]) - [3] 2022-01-28 09:45:17.751 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([delivery4_6_] : [BIGINT]) - [4] 2022-01-28 09:45:17.751 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([member_i5_6_] : [BIGINT]) - [1] 2022-01-28 09:45:17.751 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_da2_6_] : [TIMESTAMP]) - [2022-01-28T09:43:00.843051] 2022-01-28 09:45:17.752 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([status3_6_] : [VARCHAR]) - [ORDER] 2022-01-28 09:45:17.753 TRACE 7444 --- [nio-8080-exec-3] org.hibernate.type.CollectionType : Created collection wrapper: [jpabook.jpashop.domain.Order.orderItems#3] 2022-01-28 09:45:17.755 INFO 7444 --- [nio-8080-exec-3] p6spy : #1643330717755 | took 0ms | commit | connection 19| url jdbc:h2:tcp://localhost/~/jpashop ; 2022-01-28 09:45:17.776 DEBUG 7444 --- [nio-8080-exec-3] org.hibernate.SQL : select member0_.member_id as member_i1_4_0_, member0_.city as city2_4_0_, member0_.street as street3_4_0_, member0_.zipcode as zipcode4_4_0_, member0_.name as name5_4_0_ from member member0_ where member0_.member_id=? 2022-01-28 09:45:17.776 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1] 2022-01-28 09:45:17.777 INFO 7444 --- [nio-8080-exec-3] p6spy : #1643330717777 | took 0ms | statement | connection 19| url jdbc:h2:tcp://localhost/~/jpashop select member0_.member_id as member_i1_4_0_, member0_.city as city2_4_0_, member0_.street as street3_4_0_, member0_.zipcode as zipcode4_4_0_, member0_.name as name5_4_0_ from member member0_ where member0_.member_id=? select member0_.member_id as member_i1_4_0_, member0_.city as city2_4_0_, member0_.street as street3_4_0_, member0_.zipcode as zipcode4_4_0_, member0_.name as name5_4_0_ from member member0_ where member0_.member_id=1; 2022-01-28 09:45:17.778 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([city2_4_0_] : [VARCHAR]) - [qq] 2022-01-28 09:45:17.778 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([street3_4_0_] : [VARCHAR]) - [qq] 2022-01-28 09:45:17.778 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([zipcode4_4_0_] : [VARCHAR]) - [11111] 2022-01-28 09:45:17.778 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([name5_4_0_] : [VARCHAR]) - [qq] 2022-01-28 09:45:17.778 TRACE 7444 --- [nio-8080-exec-3] org.hibernate.type.CollectionType : Created collection wrapper: [jpabook.jpashop.domain.Member.orders#1] 2022-01-28 09:45:17.780 DEBUG 7444 --- [nio-8080-exec-3] org.hibernate.SQL : select orderitems0_.order_id as order_id5_5_0_, orderitems0_.order_item_id as order_it1_5_0_, orderitems0_.order_item_id as order_it1_5_1_, orderitems0_.count as count2_5_1_, orderitems0_.item_id as item_id4_5_1_, orderitems0_.order_id as order_id5_5_1_, orderitems0_.order_price as order_pr3_5_1_ from order_item orderitems0_ where orderitems0_.order_id=? 2022-01-28 09:45:17.780 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [3] 2022-01-28 09:45:17.782 INFO 7444 --- [nio-8080-exec-3] p6spy : #1643330717782 | took 1ms | statement | connection 19| url jdbc:h2:tcp://localhost/~/jpashop select orderitems0_.order_id as order_id5_5_0_, orderitems0_.order_item_id as order_it1_5_0_, orderitems0_.order_item_id as order_it1_5_1_, orderitems0_.count as count2_5_1_, orderitems0_.item_id as item_id4_5_1_, orderitems0_.order_id as order_id5_5_1_, orderitems0_.order_price as order_pr3_5_1_ from order_item orderitems0_ where orderitems0_.order_id=? select orderitems0_.order_id as order_id5_5_0_, orderitems0_.order_item_id as order_it1_5_0_, orderitems0_.order_item_id as order_it1_5_1_, orderitems0_.count as count2_5_1_, orderitems0_.item_id as item_id4_5_1_, orderitems0_.order_id as order_id5_5_1_, orderitems0_.order_price as order_pr3_5_1_ from order_item orderitems0_ where orderitems0_.order_id=3; 2022-01-28 09:45:17.782 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_it1_5_1_] : [BIGINT]) - [5] 2022-01-28 09:45:17.783 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([count2_5_1_] : [INTEGER]) - [3] 2022-01-28 09:45:17.783 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([item_id4_5_1_] : [BIGINT]) - [2] 2022-01-28 09:45:17.783 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_id5_5_1_] : [BIGINT]) - [3] 2022-01-28 09:45:17.783 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_pr3_5_1_] : [INTEGER]) - [1111] 2022-01-28 09:45:17.783 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_id5_5_0_] : [BIGINT]) - [3] 2022-01-28 09:45:17.783 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([order_it1_5_0_] : [BIGINT]) - [5] 2022-01-28 09:45:17.784 DEBUG 7444 --- [nio-8080-exec-3] org.hibernate.SQL : select item0_.item_id as item_id2_3_0_, item0_.name as name3_3_0_, item0_.price as price4_3_0_, item0_.stock_quantity as stock_qu5_3_0_, item0_.artist as artist6_3_0_, item0_.etc as etc7_3_0_, item0_.author as author8_3_0_, item0_.isbn as isbn9_3_0_, item0_.actor as actor10_3_0_, item0_.director as directo11_3_0_, item0_.dtype as dtype1_3_0_ from item item0_ where item0_.item_id=? 2022-01-28 09:45:17.787 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [2] 2022-01-28 09:45:17.788 INFO 7444 --- [nio-8080-exec-3] p6spy : #1643330717788 | took 0ms | statement | connection 19| url jdbc:h2:tcp://localhost/~/jpashop select item0_.item_id as item_id2_3_0_, item0_.name as name3_3_0_, item0_.price as price4_3_0_, item0_.stock_quantity as stock_qu5_3_0_, item0_.artist as artist6_3_0_, item0_.etc as etc7_3_0_, item0_.author as author8_3_0_, item0_.isbn as isbn9_3_0_, item0_.actor as actor10_3_0_, item0_.director as directo11_3_0_, item0_.dtype as dtype1_3_0_ from item item0_ where item0_.item_id=? select item0_.item_id as item_id2_3_0_, item0_.name as name3_3_0_, item0_.price as price4_3_0_, item0_.stock_quantity as stock_qu5_3_0_, item0_.artist as artist6_3_0_, item0_.etc as etc7_3_0_, item0_.author as author8_3_0_, item0_.isbn as isbn9_3_0_, item0_.actor as actor10_3_0_, item0_.director as directo11_3_0_, item0_.dtype as dtype1_3_0_ from item item0_ where item0_.item_id=2; 2022-01-28 09:45:17.788 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([dtype1_3_0_] : [VARCHAR]) - [B] 2022-01-28 09:45:17.789 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([name3_3_0_] : [VARCHAR]) - [add] 2022-01-28 09:45:17.789 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([price4_3_0_] : [INTEGER]) - [1111] 2022-01-28 09:45:17.789 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([stock_qu5_3_0_] : [INTEGER]) - [1108] 2022-01-28 09:45:17.789 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([author8_3_0_] : [VARCHAR]) - [dffdsf] 2022-01-28 09:45:17.789 TRACE 7444 --- [nio-8080-exec-3] o.h.type.descriptor.sql.BasicExtractor : extracted value ([isbn9_3_0_] : [VARCHAR]) - [3432423] 2022-01-28 09:45:17.789 TRACE 7444 --- [nio-8080-exec-3] org.hibernate.type.CollectionType : Created collection wrapper: [jpabook.jpashop.domain.item.Item.categories#2] 소스코드 : https://github.com/AmyLim328/springboot-jpa-jpashop
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
주문취소와 영속성 컨텍스트
1. 테스트의 주문취소 부분에서, 멤버가 가지고 있는 order에도 주문취소가 적용되는 지 확인하고 싶어 assertEquals(OrderStatus.CANCEL, member.getOrders().get(0).getStatus()); 이렇게 코드를 추가해보니 테스트가 통과되더라구요. 이것도 영속성컨텍스트가 다 관리해주기 때문인가요?? 2. 혹시나 하는 호기심에 cancelOrder대신에 em.remove 를 사용하여 해당 Order를 지워봤습니다. 그렇게 할 경우 db내에서 해당 튜플은 지워지지만 위에처럼 객체 내에서 추적하여 Member가 가지고 있는 Order에 영향을 주는가했더니 그렇지 않더라구요. 이런식으로 작동하는것이 맞나요? 아니면 제가 놓치고 있는것이 있을까요. 3. (2번이 맞다는가정의 질문) 앞으로 다른 앱을 만들 때 게시글이라던지 특정 객체를 삭제하고 싶을 때, 영속성 컨텍스트가 관리를 해주기 원한다면, 이런식으로 일종의 논리삭제를 해주는 식으로 진행해야 하는건가요?
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
주문취소 테스트시
주문취소쪽 테스트하다가 궁금한점 있어 질문드립니다. 취소할 주문ID를 조회하고 Order order = orderRepository.findOne(orderId); order.cancel(); 로 주문취소하기 전에 orderItems에 값이 넣어져 있는지 모르겠습니다. Order와 OrderItem은 @OneToMany로 기본이 LAZY 로딩이라 orderItems을 직접 호출하기 전까지는 데이터를 조회하지 않는거로 알고 있는데 어떻게 orderItems에 값이 채워져서 취소가 되는지요?... for (OrderItem orderItem : orderItems) { orderItem.cancel();} 저 for문 시점에 데이터를 조회하면 이해하겠는데 디버깅해보면 order를 조회할때 이미 값이 다 채워져 있습니다...