Linda/Rainer,
Good point, thanks.
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?
Werner
-------- Original-Nachricht --------
> Datum: Wed, 15 Jun 2011 14:06:24 +0200
> Von: "Rainer Kwesi Schweigkoffer" <kwesi_at_sap.com>
> An: Linda DeMichiel <linda.demichiel_at_oracle.com>, jsr338-experts_at_jpa-spec.java.net
> Betreff: [jsr338-experts] Re: updated spec draft
> Hi Linda,
>
> thanks a lot for all the changes. We will discuss the remaining open
> issues in the concall then.
>
> One thing I have come across, though, is whether we need an additional
>
> <X, T extends X> Root<T> treat(Root<X> root, Class<T> type)
>
> method at CriteriaBuilder. Take, for instance,
>
> SELECT p
> FROM Product p
> WHERE 10000 < ALL (
> SELECT a.balance
> FROM (TREAT p as Book).writer w
> JOIN w.accounts a
> )
>
> The cast at
>
> CriteriaQuery<Product> q = cb.createQuery(Product.class);
> Root<Product> product = q.from(Product.class);
> Subquery<Integer> sq = q.subquery(Integer.class);
> Root<Book> orderSub = (Root<Book>)
> cb.treat(sq.correlate(product), Book.class);
> Join<Book,Author> writer = orderSub.join(Book_.writer);
> Join<Author,Account> account = writer.join(Author_.accounts);
> sq.select(account.get(Account_.balance));
> q.where(cb.lt(cb.literal(10000), cb.all(sq)));
>
> seems to be a bit ugly to me.
>
> Best regards
> Rainer
>
>
> Linda DeMichiel, am 10 Jun 2011 hast Du um 12:20 zum Thema
> "[jsr338-experts] updated spec draft" geschrieben :
>
> > I've just uploaded another specification draft to the jpa-spec project,
> > http://java.net/projects/jpa-spec/downloads.
> >
> > This incorporates the technical changes that I've indicated in recent
> > email correspondence and other minor fixes (corrections to typos, etc.)
> >
> > I am planning to hold a concall to address open issues once we have
> > more of a critical mass of these, and once my schedule frees up a bit.
> >
> > The changebars are additive from the last draft, as I am not planning
> > to reset changebars until after we release a milestone draft to the
> > JCP site.
> >
> > -Linda
> >
>
>
> ---
> 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.
>
>
--
NEU: FreePhone - kostenlos mobil telefonieren!
Jetzt informieren: http://www.gmx.net/de/go/freephone