users@glassfish.java.net

Re: EJB QL to SQL mapping

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Mon, 28 Jul 2008 18:05:38 -0700

The best way to see generated sql for your object model is turn on sql
logging. You can turn on sql logging by adding following property to
your persistence.xml

        <property name="toplink.logging.level" value="FINE"/>

glassfish_at_javadesktop.org wrote:
> Hi,
> I would like to know how JPA translates EJB QL to underylying SQL.
> e.g. object model - parent table Person that has 1-N relationship with dependent table Address and also 1-N with Phone. There is no direct relationship between Address and Phone.
> The primary/foreign keys are Personid primary key in Person table and Personid as foreign key in Phone and Address table.
> So each Person object can contain multiple Addresses and multiple Phones.
>
> Objective - To retrieve set of Person with their Addresses and Phones where Person.firstName = 'Scott'
>
> What SQL query(s) will be issued by JPA to the underlying database.
> [Message sent by forum member 'swaranjitdua' (swaranjitdua)]
>
> http://forums.java.net/jive/thread.jspa?messageID=289971
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>