users@jpa-spec.java.net

[jpa-spec users] [jsr338-experts] Re: Proposal for EntityGraphs, fetch plans, etc...

From: Oliver Gierke <ogierke_at_vmware.com>
Date: Fri, 7 Dec 2012 10:29:54 -0800 (PST)

Am 07.12.2012 um 18:57 schrieb Gordon Yorke <gordon.yorke_at_oracle.com>:

> It was removed from an earlier draft version to reduce the clutter in the NamedEntityManager annotation as NamedAttributeNode serves the same purpose. It also eliminates any confusion about when to use the String[] vs the NamedAttributeNode[] and how they interact.
> --Gordon

I guess you mean NamedEntityGraph, right? I don't think an additional simple attribute is clutter actually. Also, I can't see any confusion as the String[] can easily be evaluated like an @NamedAttributeNode with a plain name attribute and would be added to other @NamedAttributeNode declarations. Simple rule, no corner cases. Especially in scenarios where you'd simply list a couple of Strings this would actually *reduce* clutter and complexity on the definition side. Make the simple things simple, complex things possible.

The examples you showed were referring to a few properties only and already consumed quite a bit of space. Assuming real world scenarios, this overhead would even grow beyond that. It's yet another annotation per property to refer to. I'd actually would be interested in seeing an XML definition example because it feels like the annotation based definition might actually be more verbose than the XML equivalent.

I strongly recommend to favor conciseness on the definition / user side of things over a few more lines of implementation code. Parts of the spec already do a suboptimal job in this regard and I think we do the users and the spec a favor if we make it as usable as possible.

Cheers,
Ollie

- Sent while on the run...

> On 07/12/2012 12:58 PM, Oliver Gierke wrote:
>> Am 07.12.2012 um 15:20 schrieb Gordon Yorke <gordon.yorke_at_oracle.com>:
>>
>>>> I like Oliver's proposal of String[] to list simple types. It makes the
>>>> API and annotations much more palatable.
>>> Yes, that was in an earlier version of the proposal.
>> What exactly does that mean? Was it in there and has been abandoned? If so, why?
>>
>> Cheers,
>> Ollie
>>
>