persistence@glassfish.java.net

RE: question on entity relationships

From: Eve Pokua <gorgeous65_at_msn.com>
Date: Wed, 14 Nov 2007 15:07:03 +0000

Thanks James

I will try it and let you know.

eve

> Date: Wed, 14 Nov 2007 06:20:25 -0800
> From: jamesssss_at_yahoo.com
> To: persistence_at_glassfish.dev.java.net
> Subject: Re: question on entity relationships
>
>
> The JPQL would be,
>
> "Select i.id, i.name, i.description, i.colour, i.size, o.oid, o.date,
> o.quantity from Order o, in(o.items) i"
>
> You could also just select the Order and fetch join the items, if you wanted
> the objects back. Or just select the Orders can access the items from them
> in Java.
>
> "Select o from Order o join fetch o.items"
>
> "Select o from Order o"
>
>
> Eve Pokua wrote:
> >
> >
> > Hello everyone,
> >
> > I would like to know how to retrieve certain data from the DB with respect
> > to entity relationship. Consider the following SQL statement.
> >
> > "Select i.id, i.name, i.description, i.colour, i.size, o.oid, o.date,
> > o.quantity from Item i, Order o"
> >
> > Or a very complex SQL statement using JOIN in tables.
> >
> > The Order entity is a 1 to many relation to Item - an order can have many
> > items. But when retrieving the details from order, I want to see certain
> > data from the Order table as stated above, but not all the data from
> > Order. How do I achieve this in EJB3 query?
> >
> > Thanks
> >
> > eve
> >
>
>
> -----
> ---
> http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
> http://www.oracle.com/technology/products/ias/toplink/ Oracle TopLink ,
> http://www.eclipse.org/eclipselink/
> EclipseLink , https://glassfish.dev.java.net/javaee5/persistence/ TopLink
> Essentials
> Wiki: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence ,
> http://wiki.eclipse.org/EclipseLink EclipseLink
> Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
> http://www.nabble.com/EclipseLink-f26430.html EclipseLink ,
> http://www.nabble.com/java.net---glassfish-persistence-f13455.html Glassfish
> Persistence
> --
> View this message in context: http://www.nabble.com/question-on-entity-relationships-tf4804935.html#a13747259
> Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.

_________________________________________________________________
Celeb spotting – Play CelebMashup and win cool prizes
https://www.celebmashup.com