jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: updated spec draft

From: Rainer Kwesi Schweigkoffer <kwesi_at_sap.com>
Date: Wed, 15 Jun 2011 14:31:54 +0200

Sorry, Werner,

Werner Keil, am 15 Jun 2011 hast Du um 14:11 zum Thema "[jsr338-experts] Re: updated spec draft" geschrieben :

> Why does it work without casting for all of these:
> CriteriaQuery<Product> q = cb.createQuery(Product.class);
> Root<Product> product = q.from(Product.class);
> Subquery<Integer> sq = q.subquery(Integer.class);
>
> And not here:
> Root<Book> orderSub = (Root<Book>)
> cb.treat(sq.correlate(product), Book.class);
>
> Using similar knowledge as the above (Product.class or Integer.class) cb.treat seems to have the same by providing Book.class or is there a reason why it won't work in that case?

but I am not getting you here. Actually, I am casting from Path<Book>
to Root<Book>.

You'd have the same issue with

SELECT p FROM Product p OUTER JOIN (TREAT p AS Book).writer w

which brings me to the question of whether this query would or would
not return products that are not books. Probably it wouldn't as

SELECT p FROM Product p JOIN (TREAT p AS Book).writer w

would not, but I would like to make sure.

Moreover, what will

SELECT p FROM Product p
         OUTER JOIN TREAT((TREAT p AS Book).writer AS AmateurWriter) a

do to books from professional authors ?

Kind regards
Rainer

---
Rainer Schweigkoffer                      SAP AG Walldorf
Business Solution & Technology            TD Core JS&I
Technology Development                    Dietmar-Hopp-Allee 16
Java Server Core                          D-69190 Walldorf
JEE Implementation Group           phone: +49 6227 7 45305
Building 3, I.3.14                 fax:   +49 6227 7 821177
rainer.schweigkoffer_at_sap.com
Sitz der Gesellschaft/Registered Office: Walldorf, Germany
Vorstand/SAP Executive Board: Werner Brandt, Angelika Dammann,
Bill McDermott (Co-CEO), Gerhard Oswald, Vishal Sikka,
Jim Hagemann Snabe (Co-CEO)
Vorsitzender des Aufsichtsrats/Chairperson of the SAP Supervisory 
Board: Hasso Plattner
Registergericht/Commercial Register Mannheim No HRB 350269
Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige
vertrauliche Informationen enthalten. Sollten Sie diese E-Mail 
irrtuemlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, 
eine Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich 
untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die 
empfangene E-Mail. Vielen Dank.
This e-mail may contain trade secrets or privileged, undisclosed, or
otherwise confidential information. If you have received this e-mail 
in error, you are hereby notified that any review, copying, or 
distribution of it is strictly prohibited. Please inform us 
immediately and destroy the original transmittal. Thank you for your 
cooperation.