I have a many-to-one where the 'one' part has a key value, but no row in the DB.
I need to be able to access the key for this missing row, but I get an ObjectNotFoundException.
My understanding is that the proxy contains the key value and you can access that without causing DB access.
Parent Entity:
Code:
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ORDER_ID")
private MpuEntity mpu;
MpuEntity:
Code:
@Id
@Column(name = "ORDER_ID", unique = true, nullable = false)
private Long orderId;
Issue (this throws a ObjectNotFoundException):
Code:
Long id = parent.getMpu().getOrderId();
Is there a way to get the key value when the child row does not exist ?
Thanks,
Craig.