Код: Выделить всё
@MappedSuperclass
public abstract class CommonDate extends HibernatePersistentObject implements Serializable {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "INSTRUMENT_ID", nullable = false, unique = true)
private InstrumentUsage instrumentUsage;
Другой класс, расширяющий CommonDate:
Код: Выделить всё
@Entity
@Table(name = "OBSERVATION_DATES")
public class ObservationDate extends CommonDate {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "DATES_SEQ")
@SequenceGenerator(name = "DATES_SEQ", sequenceName = "DATES_SEQ")
@Column(name = "OBSERVATION_DATE_ID")
private int ObservationDateId;
public ObservationDate(InstrumentUsage instrumentUsage) {
super(instrumentUsage);
}
public ObservationDate() {
super();
}
И есть третий класс в конструкторе : InstrumentUsage.
Код: Выделить всё
@MappedSuperclass
public abstract class InstrumentUsage extends HibernatePersistentObject implements Serializable {
Код: Выделить всё
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on domain.ObservationDate.instrumentUsage references an unknown entity: domain.InstrumentUsage
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:100)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processEndOfQueue(InFlightMetadataCollectorImpl.java:1808)
Подробнее здесь: https://stackoverflow.com/questions/792 ... superclass
Мобильная версия