openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russell Collins <Russell.Coll...@mclaneat.com>
Subject RE: Unnecesery INNER JOIN
Date Thu, 15 Jul 2010 21:41:09 GMT
>From the looks of what you have in your query, there has to be a join of some kind.  You
are trying to get the "id" of class "A" that is associated with class "B".  If this is not
your desire, what are you trying to do?

-----Original Message-----
From: QkI [mailto:kukismen@gmail.com]
Sent: Thursday, July 15, 2010 8:19 AM
To: users@openjpa.apache.org
Subject: Unnecesery INNER JOIN


Hi,
Let's say I have the following persistence class:

@Entity
public class B {

  @OneToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  @JoinColumn(name = "a_id")
  private A a;
}

and when I try to execute this JPA query:
SELECT b.a.id FROM B where B.id = 123

my SQL output looks like:
SELECT t1.id FROM table_b t0 INNER JOIN table_a t1 ON t0.a_id = t1.id WHERE
(t0.id = 123)

Why does openJPA add unnecesery JOIN to the SQL query.
Can I somehow change this behaviour of openJPA

Thanks,
QkI


--
View this message in context: http://openjpa.208410.n2.nabble.com/Unnecesery-INNER-JOIN-tp5297321p5297321.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

CONFIDENTIALITY NOTICE: The information contained in this electronic mail (email) transmission
(including attachments), is intended by MCLANE ADVANCED TECHNOLOGIES for the use of the named
individual or entity to which it is addressed and may contain information that is privileged,
confidential and/or protected as a trade secret. It is not intended for transmission to, or
receipt by, any individual or entity other than the named addressee(s). If you have received
this email in error, please delete it (including attachments) and any copies thereof without
printing, copying or forwarding it, and notify the sender of the error by email reply immediately.

Mime
View raw message