Ron,

For the insert statement I'm all about just using the built-in
properties support and doing something ala:

<selectKey property="FooID" resultClass="int">
      ${DefaultSelectKey}
</selectKey>

I've never tested that but from some of the other syntax I've seen
used it should work.

-Chad

On 4/28/05, Ron Grabowski <[EMAIL PROTECTED]> wrote:
> > <database>
> >  <provider name="OleDb1.1" defaultSelectKey="SELECT @@IDENTITY"/>
> >  <dataSource name="abc" connectionString="xyz" />
> > </database>
> 
> Here are some possible improved <insert> statements:
> 
> <insert id="InsertFoo" parameterClass="Foo">
>   INSERT INTO Foo (Name, DateAdded) VALUES (#Name#, ${GetDate})
>  <selectKey property="FooId" resultClass="int" />
> </insert>
> 
> <insert id="InsertFoo" parameterClass="Foo" >
>   INSERT INTO Foo (Name, DateAdded) VALUES (#Name#, ${GetDate})
>  <selectKey useDefaultSelectKey="false" property="FooId"
> resultClass="int">
>   SELECT SCOPE_IDENTITY()
>   </selectKey>
> </insert>
> 
> <!-- automagically attaches <selectKey> -->
> <insert id="InsertFoo" parameterClass="Foo" resultClass="int">
>   INSERT INTO Foo (Name, DateAdded) VALUES (#Name#, ${GetDate})
> </insert>
> 
> Easier to understand, more difficult, don't care?
>

Reply via email to