Hi,

our DBAs detected a strange SQL statement in conjunction w/ a bidirectional
one-to-one relationship between entities. I compiled a minimal example that
demonstrates the case:



When querying an entity of type A the following SQL is executed:



The select starts at table A and performs a join to table B (fine). Then
there's another join back to A again (strange). We are using OpenJPA 2.0.1.
The double join happens (at least) w/ dictionairies for Derby and DB2.

During my research, I came upon this ticket:
https://issues.apache.org/jira/browse/OPENJPA-292 which seems to be
unresolved. Can I assume that this error still exists? Did the patch go into
the 2.x versions?

A possible workaround (using lazy loading and fetching the relationships
with fetch join queries) is not applicable in our situation since the
relationships are not necessarily fetched by queries.

I am also aware that a bidirectional one-to-one relationship is not the best
design, but the data is spread on two tables and some legacy COBOL
transaction are accessing these tables. A schema change is not possible.

Any ideas?

TIA,
Tobias



--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Unnecessary-Join-on-bidirectional-OneToOne-relation-tp6900378p6900378.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to