They both need to have a one-to-one mapping. In the SubRequest table I need to have the Primary Key and the Foreign key on the same column (which is RequestID) .
It is easily done in DB. My application uses Hibernate. So in the hibernate mappings file I need to do the same.
Also, the requirement is that this key must be a VARCHAR and generated by the application and not auto-generated by DB. I tried doing it from the following:
This is coming when inserting a row in SubRequest table. It seems it is trying to find REQUEST_REQUEST_ID column instead of the REQUEST_ID. I found that hibernate is getting this column name by taking the @MapId variable name and appending it with the column name which we have given in the @Column. Ideally it should have just used the name mentioned in the @Column right?