jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: JPA 2.1 specification draft

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Thu, 26 May 2011 16:16:15 -0300

Hello Rainer,

Rainer Kwesi Schweigkoffer wrote:
> Hi Gordon, all,
>
> Gordon Yorke, am 25 May 2011 hast Du um 13:49 zum Thema "[jsr338-experts] Re: JPA 2.1 specification draft" geschrieben :
>
>
>> Section 3.8.16.2.1 - Entities returned are more likely to be detached
>> than new as they will have a persistent identity.
>>
>
> It might be confusing for users if behaviour in 3.8.16.2.1 differs from
> the one in 4.8.2, imho.
>
I agree. It is my opinion that 4.8.2 is technically incorrect and the
Entities may be detached or new depending on if the PK was retrieved.
>
>> Section 6.3.5 - Should not need method : "<Y> CriteriaUpdate<T>
>> set(Path<Y> attribute, Y value);" as the next method also covers this case.
>>
>
> Do you mean people should rather say
>
> updateQuery.set(myPath, queryBuilder.literal(5))
>
> than
>
> updateQuery.set(myPath, 5) ?
>
No, I somehow misread the method. This set method should not be removed
although it should be:
<X extends Y> set(Path<Y> attribute, X value);
>
>
>> Section 6.3.1 &6.5.7 &6.5.8 - Treat should not operate on the metamodel,
>> it should only operate on the path expressions. I know the pattern
>> chosen for the JPQL has the JOIN TREAT operating on the metamodel but
>> the where clause definely operates on the path expression. Operating on
>> the path expression is far smoother than operating on both the path
>> expression and the metamodel. The treat methods can be reduced to
>> methods that take Path<> and Join<>. The examples would then become:
>>
>> CriteriaQuery<Customer> q = cb.createQuery(Customer.class);
>> Root<Customer> customer = q.from(Customer.class);
>> Join<Customer, Order> order = customer.join(Customer_.orders);
>> q.where(cb.equal(cb.treat(order.get(Order_.product),
>> Book.class).get(Book_.name),"Iliad"));
>> q.select(customer);
>>
>> and
>>
>> CriteriaQuery<String> q = cb.createQuery(String.class);
>> Root<Order> order = q.from(Order.class);
>> Join<Order,Book> book = cb.treat(order.join(Order_.product),
>> Book.class);
>> q.select(book.get(Book_.isbn));
>>
>
>
> Yup.
>
>
>> Section 6.5.15 - example 2 should not be using Employee_ metamodel
>> elements for Address attributes. Should also add a note to the spec
>> stating that updating across implicit joins is not supported.
>>
>
> I agree.
>
> Best 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.
>
>
>