LoginSignup
6
4

More than 5 years have passed since last update.

JPAの「Repeated column in mapping for entity」エラー

Last updated at Posted at 2019-02-07
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: jp.co.XXX.entity.Case column: contact__herokurecordid__c (should be mapped with insert="false" update="false")

とのエラーになったら以下のように@JoinColumninsertable = false, updatable = falseを書く

    @Column(name = "contact__herokurecordid__c", length = 255)
    private String contactHerokuRecordId;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "contact__herokurecordid__c", referencedColumnName = "herokurecordid__c", insertable = false, updatable = false)
    @Setter(AccessLevel.NONE)
    private Contact contact;

    public String getContactLastName() {
        if (contact != null) {
            return contact.getLastName();
        }
        return null;
    }
6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4