Looks good to me.
Thanks,
Andrei
----- Original Message -----
From: "jielin" <Jie.Leng_at_Sun.COM>
To: <persistence_at_glassfish.dev.java.net>
Sent: Wednesday, November 08, 2006 7:44 PM
Subject: code review for issue 1388
> Hi, Tom,
>
> Attahced is the fix for issue 1388. Could you please review the fix?
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=1388.
>
> The problem is that a bulk UPDATE statement setting a field of an
> embedded instance changes a column mapped to a field of the entity
> instance, if the field of the embedded instance has the same name as a
> field of the entity. So
>
> Query "UPDATE Customer c SET c.country.name = 'CHANGED'" generates "UPDATE
> CUSTOMER_TABLE SET NAME = 'CHANGED'"
> instead of "UPDATE CUSTOMER_TABLE SET COUNTRY_NAME = 'CHANGED'"
>
> The causing is in ExpressionQueryMechanism:prepareUpdateAll().
> When mapping field to column, the following code is only taking field name
> as a string argument.
> field =
> getDescriptor().getObjectBuilder().getFieldForQueryKeyName(fieldExpression.getName());
> So 'c.country.name' is only passing 'name', once there is field name
> matching at the class level, it will return the column.
>
> The fix for this is before calling the above code, check if the field is
> at class level.
>
> Tested with entity-persistence-tests.
>
> Thanks.
>
> Jielin
>
>