jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: JPQL update statements and embeddables

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Sun, 13 Mar 2011 13:48:16 -0700

Hi Werner,

I think the new values should be set.

-Linda


On 3/13/2011 12:17 PM, Werner Keil wrote:
> Looks good to me.
>
> What happens, if e.address was null? Are these values ignored or is an
> exception thrown?
>
> Werner
>
> ----- Original Message ----- From: "Linda DeMichiel"
> <linda.demichiel_at_oracle.com>
> To: <jsr338-experts_at_jpa-spec.java.net>
> Sent: Saturday, March 12, 2011 7:10 AM
> Subject: [jsr338-experts] JPQL update statements and embeddables
>
>
>> The syntax for the JPQL bulk update statement is:
>>
>> update_statement ::= update_clause [where_clause]
>> update_clause ::= UPDATE entity_name [[AS] identification_variable]
>> SET update_item {, update_item}*
>> update_item ::= [identification_variable.]{state_field |
>> single_valued_object_field} =
>> new_value
>> new_value ::=
>> scalar_expression |
>> simple_entity_expression |
>> NULL
>>
>>
>> This seems too restrictive, in that it does not allow for the updating
>> of embeddables that are directly contained in entities (i.e., stored
>> in the entity table).
>>
>> I propose the following update to the syntax and semantics to allow the
>> update of state fields or single-valued association fields that are
>> contained as the "leaf-node" state of embeddables.
>>
>> update_item ::=
>> [identification_variable.]{single_valued_embeddable_object_field.}*{state_field
>> | single_valued_object_field} = new_value
>>
>>
>> Example UPDATE statement (and real world example :-) )
>>
>> UPDATE Employee e
>> SET e.address.building = 22
>> WHERE e.address.building = 14
>> AND e.address.city = 'Santa Clara'
>> AND e.project = 'Java EE'
>>
>>
>> Opinions ??
>>
>> thanks,
>>
>> -Linda
>