无法使用Hibernate查找具有逻辑名称的列

时间:2018-03-03 20:30:13

标签: java database oracle hibernate

Unable to find column with logical name: VERTICAL_MARKET_ID in org.hibernate.mapping.Table(bck_vertical_market) and its related supertables and secondary tables
    at org.hibernate.cfg.Ejb3JoinColumn.checkReferencedColumnsType(Ejb3JoinColumn.java:582)

任何人都可以帮忙解决这个问题吗?现有的帖子都没有帮助我。我使用VerticalMarket的类看起来像:

@Entity
@Table(name = "BCK_VERTICAL_MARKET")
public class VerticalMarketEntity implements Serializable {

       private VerticalMarketID verticalMarketId;
    private String name;

    public VerticalMarketEntity() {
    }

    public VerticalMarketEntity(VerticalMarketID verticalMarketId) {
        if (Assert.CHECK)
            Assert.notNull(verticalMarketId, "Parameter for id must be set");
        this.verticalMarketId = verticalMarketId;
    }

    @EmbeddedId
    @AttributeOverride(name = "verticalMarketId", column = @Column(name = "VERTICAL_MARKET_ID", nullable = false, length = 100))
    @Attribute(index = 0, primaryKey = true)
    public VerticalMarketID getVerticalMarketId() {
        return verticalMarketId;
    }
    @Attribute(index = 1, type = String100TD.class)
    @Column(name = "NAME", length = 100)
    @Basic
    public String getName() {
        return name;
    }

}
@Entity
@Table(name = "BCK_CERTIFICATE")
public class CertificateEntity {

    private VerticalMarketEntity verticalMarket;


    @Relation(index = 2, target = VerticalMarketEntity.class)
    @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "VERTICAL_MARKET", referencedColumnName = "VERTICAL_MARKET_ID")
    public VerticalMarketEntity getVerticalMarket() {
        return verticalMarket;
    }



@Entity
@Table(name = "BCK_OFFERED_SERVICE")
public class OfferedServiceEntity implements Serializable {


    private VerticalMarketEntity verticalMarket;

    @Relation(index = 2, target = VerticalMarketEntity.class)
    @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "VERTICAL_MARKET", referencedColumnName = "VERTICAL_MARKET_ID")
    public VerticalMarketEntity getVerticalMarket() {
        return verticalMarket;
    }
}

CREATE TABLEBCK_VERTICAL_MARKET (
  VERTICAL_MARKET_ID CHAR(36) NOT NULL,
  NAME VARCHAR2(100 CHAR) NOT NULL
)

ALTER TABLE BCK_VERTICAL_MARKET ADD CONSTRAINT PK_VERTICAL_MARKET PRIMARY KEY (VERTICAL_MARKET_ID);

CREATE TABLEBCK_CERTIFICATE (
  CERTIFICATE_ID CHAR(36) NOT NULL,
  IS_OTHER NUMBER(1) NOT NULL,
  VERTICAL_MARKET CHAR(36) NOT NULL,
  NAME VARCHAR2(100 CHAR) NOT NULL
);

ALTER TABLE BCK_CERTIFICATE ADD CONSTRAINT PK_CERTIFICATE PRIMARY KEY (CERTIFICATE_ID);

ALTER TABLE BCK_CERTIFICATE ADD CONSTRAINT FK__C_VERTICAL_MARKET_ID
  FOREIGN KEY (VERTICAL_MARKET) REFERENCES BCK_VERTICAL_MARKET (VERTICAL_MARKET_ID);


CREATE TABLE BCK_OFFERED_SERVICE (
  OFFERED_SERVICE_ID CHAR(36) NOT NULL,
  VERTICAL_MARKET CHAR(36) NOT NULL,
  OFFERED_SERVICE_TYPE CHAR(36)
) ;

ALTER TABLE BCK_OFFERED_SERVICE ADD CONSTRAINT PK_OFFERED_SERVICES PRIMARY KEY (OFFERED_SERVICE_ID);

ALTER TABLE BCK_OFFERED_SERVICE ADD CONSTRAINT FK___O_S_VERTICAL_MARKET_ID
  FOREIGN KEY (VERTICAL_MARKET) REFERENCES BCK_VERTICAL_MARKET (VERTICAL_MARKET_ID);

ALTER TABLE BCK_OFFERED_SERVICE ADD CONSTRAINT FK___O_S_T_ID
  FOREIGN KEY (OFFERED_SERVICE_TYPE) REFERENCES BCK_OFFERED_SERVICE_TYPE (OFFERED_SERVICE_TYPE_ID);

0 个答案:

没有答案