Hi,
I wanted to explicitly specify the referencedColumnName so that the developers can easily figure out which column I am joining to.
Following is the code snippet.
class ProductSpecification {
.......
@ManyToOne
//@JoinColumn(name = "\"OWNER\"",referencedColumnName = "\"ID\"", table="\"PRODUCTCATEGORY\"")
//@JoinColumn(name = "\"OWNER\"",referencedColumnName = "id")
//@JoinColumn(name = "\"OWNER\"",referencedColumnName = "\"ID\"")
@JoinColumn(name = "\"OWNER\"")
private ProductCategory productCategory;
...........
}
If I don't specify the referencedColumnName, there is no problem. It takes default primary key of the ProductCategory table.
If explicit definition is specified, I get the following errors. For individually for every commented code line, i get the respective run time error.
"Caused by: org.hibernate.AnnotationException: Cannot find the expected secondary table: no "PRODUCTMGMT" available for ProductSpecification"
"Caused by: org.hibernate.MappingException: Unable to find column with logical name: id in org.hibernate.mapping.Table("PRODUCTCATEGORY") and its related supertables and secondary tables"
"Caused by: org.hibernate.AnnotationException: Column name ID of ProductCategory not found in JoinColumns.referencedColumnName"
Could you please help me on the reason.
Thanks,
Rajesh