Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Exclude fields from Select

...so one step further:

with Collection/relation traversal the SELECT-Statement could be:
SELECT
   a.b.id,
   a.b.name,

   c.id,
   c.no, ...

   d.id,
   d.label, ...
FROM A a, IN(a.cs) c, IN(a.ds) d

But I have here now a new problem! I use query hint
eclipselink.left-join-fetch to retrieve the related data.
This query hint is not valid for the resulting SELECT-Statement! Maybe only
queries allowed which have a single object in their SELECT clause?


So, does anyone know a (better) solution?

Thanks

Joe




Joe Mc. wrote:
> 
> Hi folks,
> 
> I have some question about excluding some fields from a SELECT-Statement.
> I would in some SELECT-Statements include the denoted fields, and in some
> statements not.
> My problem is maybe the class hierarchy. Following example:
> 
> A    ->    B (embeds Bextra)    
>       ->*  C -> CE
>       ->*  D
> 
> Class A keeps some references to the classes B, C and D. Further keeps
> class C a reference to CE.
> Class A keeps a list of C and D objects.
> Class B embeds Bextra. 
> 
> So, I will fire some SELECT-Statements with the fields in the @Embeddable
> class Bextra and some statements without this embeddable class.
> 
> Is it possible?
> 
> If I use 
> SELECT a FROM A a
> I get all the fields - understandable.
> So I tried to define in the SELECT-Statements all the fields I want,
> without the fields from the Bextra class. And here I get the problem to
> define it...
> 
> SELECT 
>  // only the fields from B, without Bextra: e.g.:  a.b.bextra.city
>  a.b.id,               
>  a.b.name,
>  // now the other fields for the C and D class
>  a.cs.id          //=> Not possible: cannot navigate collection valued
> association field
>  // the same is for the collection of D objects
>  ...
> FROM A a
> 
> So, my question is:
> 1. How to exclude special fields (all in a embeddable class) in some
> SELECT-Statements
> OR
> 2. How to define the Query with all the wanted fields in the case with
> collection fields
> 
> AND
> I want only one query :-)
> 
> Is it possible?
> 
> I hope you can understand the basic concept of this scenario, otherwise do
> not hesitate to ask!
> Thanks in advance for any hints!
> 
> Regards
> 
> Mc.Joe
> 
> Key data:
> - Eclipselink 1.1.1
> - MS SQL 
> 
> 

-- 
View this message in context: http://old.nabble.com/Exclude-fields-from-Select-tp26617240p26617777.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top