강의

멘토링

커뮤니티

Inflearn Community Q&A

milban's profile image
milban

asked

Real-world! Spring Boot and JPA Utilization 1 - Web Application Development

Order and OrderItem Entity Development

자신의 프로퍼티를 getter로 부르는 이유가 있을까용??

Resolved

Written on

·

288

1

아래 코드에서와 같이 자신의 프로퍼티를 getter로 부르는 이유가 있을까용???

@Entity
@Getter @Setter
public class OrderItem {
    ...
    public int getTotalPrice() {
        return getOrderPrice() * getCount();
    }
}

JPAspring웹앱javaspring-boot

Answer 3

1

milban님의 프로필 이미지
milban
Questioner

자세한 답변 정말 감사합니당 :) 

0

저도 이거 보면서 엄청 궁금했었는데 이미 질문이 있었네요!

이게 이전에 Embedded 타입 만들 때

equals랑 hash 를 오버라이딩 할 때 getter 관련 항목 체크하라는 이유랑 같은 맥락인가요!

0

yh님의 프로필 이미지
yh
Instructor

안녕하세요. 미리바니님

다음 링크를 참조해주세요^^

https://www.inflearn.com/questions/20180

감사합니다.

milban's profile image
milban

asked

Ask a question