Hi Eric 2013/10/9 Eric Schwarzenbach <[email protected]>
> Lukas, > > I realize you may not be able to make sense of all I've posted here, as I > may not have given enough context of what I was doing, and what I was > reporting vs what I was expecting was complicated by the bug in my code > around DSL.fieldByName() among other fuzzinesses on my part. > Thanks for following up. Indeed, I had started to feel a bit confused by the various ongoing threads about Field<?>, Field<T>, Field<Object> :-) It's not really important anymore since I've resolved my problem, but I > hate to leave some confusion hanging here. I was using Field for 2 things > basically. First for passing into such as the select() method for > constructing SQL which I would store for later use, in String form. In this > case, how the Field was constructed didn't matter much, as all that was > really needed was the field name. The other thing I was using it for was to > get data types to store for use later in data conversions at query > execution time for putting values to parameters and pulling data from > results. Here I was using Fields which came from the field(String name) > method of code-generated Table implementation classes (gotten from a Schema > object, gotten by reflection). For this usage a Field coming from > DSL.fieldByName(...) would not serve. > > I had some helper methods which took a Field and didn't distinguish > between Fields from the two sources and at some point I lost track of the > importance of the distiction and was trying to get the type from such a > Field that had no idea what it's type should be. > > I'm still not sure, though, that the fact that some Field objects know > their type and others don't isn't a little questionable, API-design wise. > It looks to me like you try to communicate something about this by whether > a method returns Field<T> or Field<Object> (though TableLike.field(String > name) returns Field<?>), however this is compile time information whereas > getType() and getDataType() are runtime. > Field<?> is certainly correct when using TableLike.field(String), as the concrete bound of <T> is really "unknown". Object would be wrong there, as the concrete type could by String.class. Field<Object> is correct, as Field.getType() == Object.class in this case. >From an API consistency point of view, it's true that this may lead to some confusion with Field<?>, though. If this is a sin it is a minor one at most, and as I've said, I've gotten > myself and my code straightened out on this issue, but I'm just tossing it > out there for future consideration during the eventual redesigning around > separating sql generation and execution APIs. > Yes, thanks for pointing that out. I will review these parts in the next major release: https://github.com/jOOQ/jOOQ/issues/2771 Anyway thanks for your patience in reading and responding to my ravings. :^) > Oh well, no worries :-) Cheers Lukas -- 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.
