JPA - Transient
@Transient
@Entity
public class Order {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private int quantity;
private double pricePerUnit;
@Transient
private double totalPrice; // 데이터베이스와 매핑되지 않음
public double getTotalPrice() {
return this.quantity * this.pricePerUnit;
}
}영속성 컨텍스트와의 관계
DTO 변환 시 사용
조회 성능 최적화
Last updated