users@glassfish.java.net

RE: RE: EJBQL Exception

From: Shevland, Joe <joe.shevland_at_capgemini.com>
Date: Thu, 3 May 2007 17:12:41 +1000

> Thanks much for your suggestions. It took me a while to
> implement the attributions as initially addition of the
> ManyToOne attribute caused the app server to hang. I
> eventually realized this was because the SelCat entity was
> referenced to the Seller entity only by its ID attribute (a
> String). I replaced this with an object reference, which
> resolved that problem.

Not sure whether the app server should hang with a dodgy entity
definiton; might be worth filing a bug.

> If I may ask one follow up question, with regard to the Query
> (using your simplified suggestion) in the Java method, to
> reference the attribute in the joined table do I use dot
> notation (i.e. select s from Sellers where s.Selcat.selcatid
> = :selcatID)? I've been hunting for an answer in
> documentation and the web and can't seem to find one.

In the query you reference the Java property names (irrespective of
whether the annotation is on the property or getter method); so if in
Seller you have the SellerCategory object defined as, say,

  @...
  private SellerCategory sellerCategory;

Then in the query it'll be:

  from Seller seller where seller.sellerCategory.id = :id

Cheers
Joe

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.