Hello,
I have checked this and made changes to this:
@NamedQuery(name ="getAlldetails", query=" SELECT l.pnumb, l.catergory, l.lwoltage, lm.manuname FROM Lampent l LEFT OUTER JOIN l.lamManufacturerent lm")
I am still not able to retreive data. error msg:
[#|2007-12-04T22:51:10.754+0000|INFO|sun-appserver9.1|oracle.toplink.essentials.session.file:/C:/Sun/SDK2/domains/domain1/applications/j2ee-apps/LIGHTINGSPEC/LIGHTINGSPEC-ejb_jar/-LIGHTINGSPEC-ejbPU3|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-1;|file:/C:/Sun/SDK2/domains/domain1/applications/j2ee-apps/LIGHTINGSPEC/LIGHTINGSPEC-ejb_jar/-LIGHTINGSPEC-ejbPU3 login successful|#]
[#|2007-12-04T22:51:11.234+0000|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-1;|
Can not access DB data|#]
here is the cde from my implementation:
public List<lightingspecreimp.Lampent> allLightingpro(){
List<Lampent> results=emp.createNamedQuery("getAlldetails").getResultList();
return results;
}
apprecaite your everything. thanks
eve
> From: gordon.yorke_at_oracle.com
> To: persistence_at_glassfish.dev.java.net
> Date: Mon, 3 Dec 2007 16:32:03 -0500
> Subject: RE: question on entity relationships
>
> Hello eve,
> Did you cut and paste that query or type it in? There is a typo in the FROM clause.
>
> @NamedQuery(name ="getAlldetails", query=" SELECT l.pnumb, l.catergory, l.lwoltage, lm.manuname FROM Lampent l LEFT OUTER JOIN *l*.LamManufacturerent lm")
>
> --Gordon
>
> -----Original Message-----
> From: Eve Pokua [mailto:gorgeous65_at_msn.com]
> Sent: Monday, December 03, 2007 4:28 PM
> To: persistence_at_glassfish.dev.java.net
> Subject: RE: question on entity relationships
>
>
>
>
> Thanking you for your reply.
>
> James,
>
> LamManufacturerents is the foreign key in Lampent. LamManufacturerents exists in Lampent. So the query should be like this:
>
>
> @NamedQuery(name ="getAlldetails", query=" SELECT l.pnumb, l.catergory, l.lwoltage, lm.manuname FROM Lampent l LEFT OUTER JOIN lm.LamManufacturerent lm")
>
> But i get the following errors:
>
> [#|2007-12-03T21:18:31.671+0000|INFO|sun-appserver9.1|oracle.toplink.essentials.session.file:/C:/Sun/SDK/domains/domain1/applications/j2ee-apps/LIGHTINGSPEC/LIGHTINGSPEC-ejb_jar/-LIGHTINGSPEC-ejbPU3|_ThreadID=34;_ThreadName=Thread-185;|file:/C:/Sun/SDK/domains/domain1/applications/j2ee-apps/LIGHTINGSPEC/LIGHTINGSPEC-ejb_jar/-LIGHTINGSPEC-ejbPU3 logout successful|#]
>
> [#|2007-12-03T21:18:31.687+0000|SEVERE|sun-appserver9.1|javax.enterprise.system.tools.deployment|_ThreadID=34;_ThreadName=Thread-185;_RequestID=3961ec6a-8774-47c5-876a-b986184d7369;|Exception occured in J2EEC Phase
> java.lang.StackOverflowError
> at java.util.HashMap.get(HashMap.java:300)
> at oracle.toplink.essentials.internal.parsing.ParseTreeContext.pathForVariable(ParseTreeContext.java:198)
> at oracle.toplink.essentials.internal.parsing.VariableNode.resolveClass(VariableNode.java:282)
> at oracle.toplink.essentials.internal.parsing.DotNode.resolveClass(DotNode.java:262)
> at oracle.toplink.essentials.internal.parsing.VariableNode.resolveClass(VariableNode.java:287)
> at oracle.toplink.essentials.internal.parsing.DotNode.resolveClass(DotNode.java:262)
> at oracle.toplink.essentials.internal.parsing.VariableNode.resolveClass(VariableNode.java:287)
> at oracle.toplink.essentials.internal.parsing.DotNode.resolveClass(DotNode.java:262)
> at oracle.toplink.essentials.internal.parsing.VariableNode.resolveClass(VariableNode.java:287)
>
>
> .............................
>
>
> it gos on.
>
> Thankings everyone
>
> eve
>
> ----------------------------------------
> > Date: Mon, 3 Dec 2007 07:08:22 -0800
> > From: jamesssss_at_yahoo.com
> > To: persistence_at_glassfish.dev.java.net
> > Subject: RE: question on entity relationships
> >
> >
> > Do you have any LamManufacturerent that have Lampent? This query will filter
> > out the none case, i.e. you will only get back LamManufacturerents that have
> > 1 or more Lampent.
> >
> > You could use an outerjoin if you do not wish to filter the none case.
> >
> > i.e.
> > SELECT l.pnumb, l.catergory, l.lwoltage, lm.manuname FROM LamManufacturerent
> > lm left outer join lm.lampent l
> >
> >
> > Eve Pokua wrote:
> > >
> > >
> > > Hello James/Everyone, I have finally tried your suggestion but I'm
> > > having problems retrieving data. Below are my to related entities with
> > > their relationships: @Entity_at_Table(name="LAMPS") @Named Queries({
> > > @Named Query(name ="getAlldetails", query=" SELECT l.pnumb, l.catergory,
> > > l.lwoltage, lm.manuname FROM LamManufacturerent lm, in(lm.lampent) l")}
> > > public class Lampent implements Serializable{ .........................
> > > @ManyToOne private LamManufacturerent
> > > lamManufacturerent;................... } @Entity_at_Table(name="LAMPMANU")
> > > public class LamManufacturerent implements
> > > Serializable{............................ @OneToMany(mappedBy =
> > > "lamManufacturerent") private List<Lampent> lampent; .............
> > > } Here is the JPQL: @Named Query(name ="getAlldetails", query=" SELECT
> > > l.pnumb, l.catergory, l.lwoltage, lm.manuname FROM LamManufacturerent lm,
> > > in(lm.lampent) l") Did I get it wrong because it is not working and not
> > > retrieving any data. It however works, if I do some thing like this:
> > > "Select l FROM Lampent l" It brings all data plus all the data from the
> > > related entity LamManufacturerent. But i only want manuname from
> > > LamManufacturerent. Im probably making just a little mistake. Please,
> > > help. Thankseve ________________________________> From:
> > > gorgeous65_at_msn.com> To: persistence_at_glassfish.dev.java.net> Date: Wed, 14
> > > Nov 2007 15:07:03 +0000> Subject: RE: question on entity relationships> >
> > > 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.> > ________________________________> Get free emoticon packs
> > > and customisation from Windows Live. Pimp My
> > > Live!<http://www.pimpmylive.co.uk>
> > > _________________________________________________________________
> > > Get free emoticon packs and customisation from Windows Live.
> > > http://www.pimpmylive.co.uk
> > >
> >
> >
> > -----
> > ---
> > 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/RE%3A-question-on-entity-relationships-tf4930046.html#a14131601
> > Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.
>
> _________________________________________________________________
> The next generation of MSN Hotmail has arrived - Windows Live Hotmail
> http://www.newhotmail.co.uk
_________________________________________________________________
Telly addicts unite!
http://www.searchgamesbox.com/tvtown.shtml