I'm a newbe and have a simple @OneToMany relationship to build without using a Join-Table and where the PK of table 1 is part of the PK in table 2
table 1: Exchange , PK: id table 2: ExchangeRetrievalDate, PK: exchangeId (Pk of Exchange) + date
@Entity public class Exchange { @Id private Integer id; @Column private String code; @OneToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER) private List<ExchangeRetrievalDate> exchangeRetrievalDates; }
@Entity @IdClass(com.stockdomain.domain.ExchangeRetrievalDateCK.class) public class ExchangeRetrievalDate { @Id private Integer exchangeId; @Id private Date lastRetrievaldate;
@ManyToOne @JoinColumn(name = "exchangeId", insertable = false, updatable = false) private Exchange exchange; }
@Embeddable public class ExchangeRetrievalDateCK implements Serializable { private int exchangeId; private Date lastRetrievaldate; }
Hibernate throws the following exception:
Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.exchange_exchangeretrievaldate" does not exist
|