Hibernate: @ManyToOne(fetch = FetchType.LAZY) does not work on non-primary key referenced column
问题 I have 2 tables: Order [OrderId(PK), OrderShipmentCode, ...] and Shipment[ShipmentId(PK), ShipmentCode, ...] . In Order class, I declared shipment field as follows: @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "OrderShipmentCode", referencedColumnName = "ShipmentCode", insertable = false, updatable = false, nullable = false) private Shipment shipment; When I get the list of Order , the Shipment is also loaded (I saw many separate SELECT queries). But I want the Shipment to be lazy