2013/6/5 Adam Zell <[email protected]>

> The Javadoc for Record.getValue(Field<T>) states:
>   Throws: IllegalArgumentException - If the argument field is not
> contained in fieldsRow()
>
> This is not quite true.  If the method is called with a Field that is not
> contained but has the same name as a field that is contained, the contained
> field's value will be returned instead of throwing an exception.
>
> Example:
>
> * record contains the Field FOO.ID only
> * clients calls record.getValue(BAR.ID)
> * record returns the value associated with FOO.ID
>
> I would argue that this is unwanted behavior for TableFields, in that it
> hides a likely client bug.  I would prefer to see the client bug exposed
> through an exception versus continued behavior with a possibly bogus value.
>  Does anyone prefer the existing behavior?
>

Some background info (as also mentioned in #2501 [1]):
The idea behind the current implementation dates from very early jOOQ days,
where Record.getValue() is supposed to return a "good enough" ID value,
when accessing getValue(XXX.ID). An example:

SELECT f.IDFROM FOO f


When selecting ID from records produced by the above query, you can now
either choose the exact reference f.ID, or an "approximate" reference FOO.ID,
or "ID" (String). The current implementation has a side-effect where
BAR.IDis also considered an "approximate" reference.

So the discussion should evolve around:

1. Should "approximate" references be considered at all?
2. If yes, what qualifies as an "approximate" reference? e.g.
FOO.as("f").ID is approximately the same as FOO.ID, but not as BAR.ID
3. If no, what qualifies as an "exact" reference? e.g. are these "exect"
references: field("ID"), fieldByName("ID"), fieldByName("FOO", "ID") ?

User feedback is very welcome!

Cheers
Lukas

[1]: https://github.com/jOOQ/jOOQ/issues/2501

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to