Skip to main content

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

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-tp26617240p26617240.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top