| When OneToOne associations are marked with @Cache, the caching mechanism is not able to fully support them. When two entities A and B have a OneToOne, bi-directional association where A has an @JoinColumn reference to the @Id of B and where both A and B have been cached and the association navigated from both directions (A.getB() and B.getA() methods were called), calling either A.getB() or B.getA() results in database queries to initialize the association (in the new session) from B to A because the level 2 cache relies on primary key lookup and has no support for lookup of an entity whose foreign key references a given primary key value. |