복붙노트

[SPRING] @ 봄 데이터의 과도는 작동하지 않습니다.

SPRING

@ 봄 데이터의 과도는 작동하지 않습니다.

나는 정착 법인을 가지고있다.

@Entity
@Table(name = "settlement")
public class Settlement {

    @ManyToOne
    @JoinColumn(name = "subscription_x_product_id")
    private ProductSubscription productSubscription;

ProductSubscription 엔티티와 관련된

@Entity
@Table(name = "subscriptionproduct")
public class ProductSubscription {
    @ManyToOne
    @JoinColumn(name = "product_id")
    private Product product;

제품과 관련된

@Entity
public class Product {
    @Transient
    private String enabled;

in Product 엔터티 필드에 @ org.springframework.data.annotation.Transient 주석이 달린 항목이 있습니다. 나는 또한 저장소가있다.

public interface SettlementRepository extends JpaRepository<Settlement, Integer>

내가 SettlementRepository.findAll ()을 호출하면; 그것은 예외를 일으켰습니다 : com.microsoft.sqlserver.jdbc.SQLServerException : 유효하지 않은 열 이름 'enabled'.

DB에서로드 된 필드를 무시하려면 어떻게해야합니까?

해결법

  1. ==============================

    1.솔루션을 찾았는데 문제가 Annotation @ org.springframework.data.annotation.Transient에서 @ javax.persistence.Transient로 변경되면 제대로 작동했습니다.

    솔루션을 찾았는데 문제가 Annotation @ org.springframework.data.annotation.Transient에서 @ javax.persistence.Transient로 변경되면 제대로 작동했습니다.

  2. from https://stackoverflow.com/questions/45006974/transient-in-spring-data-doesnt-work by cc-by-sa and MIT license