Hi Nicolas,
On Sat, Jul 1, 2017 at 9:57 PM, Nicolas Malin <[email protected]>
wrote:
> Hi Jacopo,
>
> I was sure that this thread will pick your interest ;)
>
Indeed it did :-)
> Le 01/07/2017 à 10:59, Jacopo Cappellato a écrit :
>
>> ...
>> GenericValue product = from("Product").where(groovyCtx).findOne()
>>
> Yeah it's a good idea to keep the same syntax with the EntityQuery but you
> are not afraid to slow down the global function ?
> I will test it to ensure this is a good way ... or not.
Most entity definitions have about 1-4 fields in the primary key: as a
consequence the above API would require to maintain a reference to the map
and then fetch from the entity definition the field names that compose the
primary key and perform 1-4 map lookups. This should not impact the
performance in a measurable way. However, only tests will tell!
Some design details: the where(Map) method should only save a reference to
the map; the actual map lookup with primary key fields should be performed
later by the findOne() method.
Regards,
Jacopo