Hi to all, I Have two entity classes modeling two tables in a legacy DB whose mapping is obtained through a composite key (an integer and a date field). When the system try to update the schema I receive this error: ERROR [SchemaUpdate] Unsuccessful: alter table N2AX_GIORNATE add constraint FK69E4EA0D7FBE51F4 foreign key (DATA, ID_DIP) references GIORNATE ERROR [SchemaUpdate] ORA-02267: tipo colonna riferente non compatibile con il tipo colonna riferita
which essentially means that the order of fields of the 'ALTER TABLE ...' statement doesn't match the order of the primary keys fields. In fact after I tried to run the SQL statement inverting the order of fields as: alter table N2AX_GIORNATE add constraint FK69E4EA0D7FBE51F4 foreign key (ID_DIP, DATA) references GIORNATE everything is right.
The fragment of code in java is:
@ManyToOne @JoinColumns({ @JoinColumn(name="ID_DIP", referencedColumnName="ID_DIP"), @JoinColumn(name="DATA", referencedColumnName="DATA") }) public CGPExceptionEvent getConcreteExceptionEvent() { return concreteExceptionEvent; } . . . The order for columns as specified in the annotation above respects the order of fields in the referred table's primary key. Could anyone give me any suggestion? Thnaks in advance
Carlo
|