It looks rather possible !
http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/ResultSetMetaData.html
(I know this is old documentation, but it's the first result I got =)
getColumnCount()
getColumnType(int column)
Dridi
On Mon, Oct 1, 2012 at 6:34 PM, Jens <
jens.ne...@gmail.com> wrote:
>
>> I don't like the idea of relying on column ordering. It's a very loose way
>> to define column mappings.
>> Constructor mapping is a very clean and easy way to manage this.
>
>
> With constructor mapping you also depend on ordering:
>
> In order to inject the results into the constructor, MyBatis needs to
> identify the constructor by the type of its parameters. Java has no way to
> introspect (or reflect) on parameter names. So when creating a constructor
> element, ensure that the arguments are in order, and that the data types are
> specified.
>
> So it does not make much of a difference if you define the mapping in xml or
> let it be defined via convention based on the ResultSet metadata column
> information. In both cases you depend on ordering just because Java does not
> give you enough information.
>
> +1 for convention, if possible.
>
> -- J.