Hi,
Sorry for delayed response.
Let me restate the problem to see if I understand it correctly
1. Entity A has a one-to-one, lazily fetched relation to Entity B.
public class A {
@OneToOne(fetch=LAZY)
private B b;
2. You want to get an instance of A in memory, but not the related
instance of B. Nor you want a join between Table for A and Table for B.
3. But you should be able to access the primary field of B because OpenJPA
has fetched the value but hidden it somewhere.
I have attached a sketch of how this can be done in three attached file,
hopefully they are self-explanatory :)
http://n2.nabble.com/file/n1574366/TestFetch2.java TestFetch2.java
http://n2.nabble.com/file/n1574366/FA.java FA.java
http://n2.nabble.com/file/n1574366/FB.java FB.java
The short answer is you need to get hold of OpenJPAStateManager for A --
the proxy object that intercepts and manages the persistent state of
original A. That StateManager has the primary key of B which saves OpenJPA
another join in case the user later calls A.getB().
--
View this message in context:
http://n2.nabble.com/Get-%40Id-field-value-%28FK%29-without-loading-entity-%28JOIN%29-when-using-FetchGroups-or-Lazy-Loading-tp1499463p1574366.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.