ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject Re: ResultMap with constructor injection
Date Tue, 18 Jul 2006 04:16:35 GMT
In Java land I was thinking of simply adding the following to the current
<result> element...

Currently we can do:

    <result property="FirstName" column="FIRST_NAME" />

I'd like to add...

    <result field="_firstName" column="FIRST_NAME"/>  <!-- I'm not
advocating underscores -->

...and...

    <result column="FIRST_NAME" />

The latter (which lacks both property and field attributes) would be a
constructor parameter.  It would have to follow some rules:

    1) Constructor results must come first in the result map defn.
    2) Constructor results must be in the same order as the parameters of
the constructor.

I think constructor and field support would be awesome in both the .NET and
Java versions.

Thoughts?

Clinton


On 7/17/06, Peter Mills <development@peter.mills.to> wrote:
>
> Yes, actually.
>
> I'd prefer to make some properties read only, having them set only in
> the constructor.  I'd use this for simple, immutable, value types, as
> well as for some mandatory properties on mutable objects.
>
> Alexandre Grenier wrote:
>
> >You mean to allow read only instance members?
> >
> >-----Original Message-----
> >From: Peter Mills [mailto:development@peter.mills.to]
> >Sent: Monday, July 17, 2006 8:44 PM
> >To: user-cs@ibatis.apache.org
> >Subject: ResultMap with constructor injection
> >
> >Greetings,
> >
> >It does not currently seem possible to create a resultMap, in DataMapper
> >
> >1.5 Beta, which only does constructor based injection.  If there is no
> >result element, then execution fails with an
> >XmlSchemaValidationException.  If I'm not in error, and this
> >functionality doesn't exist,  it would be greatly appreciated.
> >
> >Cheers,
> >
> >Peter
> >
> >Exception Message:
> >"The element 'resultMap' in namespace 'http://ibatis.apache.org/mapping'
> >
> >has incomplete content. List of possible elements expected: 'result' in
> >namespace 'http://ibatis.apache.org/mapping'."
> >
> >
> >
>
>

Mime
View raw message