org.hibernate.MappingException: Unable to find column with logical name
This error is telling you that there is no column on the medical_company table called medical_company_id. The column on medical_company is just called id.
I would remove the referencedColumnName attribute in MedicalCompany because you are naming the primary key field of AccountEntity. I think it is only necessary if you if it references a non-primary-key field.
@JoinColumn(name = "medical_company_id", referencedColumnName = "account_entity_id")
I received same error for different situation. I try to join 2 table with String key. This code block send same error.
@OneToMany
@JoinColumn(name = "SHIPMENT_ID", referencedColumnName = "PRODUCT_SHIPMENT_GROUP")
private List<ProductShipment> productShipments = new ArrayList<>();
I solved question with adding column and Fetch type (I have 2 join in the entity so I need to add FetchMode)=>
@OneToMany
@JoinColumn(name = "SHIPMENT_ID", referencedColumnName = "PRODUCT_SHIPMENT_GROUP")
@Fetch(value = FetchMode.SUBSELECT)
private List<ProductShipment> productShipments = new ArrayList<>();
@Column(name = "PRODUCT_SHIPMENT_GROUP")
private String productShipmentGroup;