hi steven

it was actually $$ not ##.
this works for me it will also get the last insert key change to suit db ie 
@@identity sqlserver

<insert id="test" parameterClass="string">
                  $value$
                  <selectKey resultClass="int"> 
                        select LAST_INSERT_ID()
                </selectKey>
        </insert>

java code
public void test(String x) throws SQLException {
        // TODO Auto-generated method stub
        Integer z = (Integer)sqlMap.insert("test",x);
        //z is now the key for the row you inserted
        
}

steve


-----Original Message-----
From: Steven Pannell [mailto:[EMAIL PROTECTED]
Sent: Wed 3/23/2005 12:36 PM
To: 'ibatis-user-java@incubator.apache.org'
Subject: RE: execute SQL statement that are not in a map
 
Hi,

I tried this to execute my dynamic SQL statement but does not work.  anyone
an idea how to resolve this???
The SQL statements have to be built in the java code, so I cannot use a
standard map.


        <statement id="execute-rule" parameterClass="string"
resultClass="long" >
                <![CDATA[
                        #value#
                ]]>
        </statement>

//Java code

client.insert("execute-rule","insert into myTable(id) values (1)");


THX,
steve.


-----Original Message-----
From: James, Steven [mailto:[EMAIL PROTECTED]
Sent: 22 March 2005 17:00
To: ibatis-user-java@incubator.apache.org
Subject: RE: execute SQL statement that are not in a map


create a generic statement in a sqlmap 
<statement id="Execute" parameterClass="string">
     #string
</statement>


-----Original Message-----
From: Steven Pannell [mailto:[EMAIL PROTECTED]
Sent: Tue 3/22/2005 3:16 PM
To: 'ibatis-user-java@incubator.apache.org'
Subject: execute SQL statement that are not in a map
 
Hi,

I build some SQL statements in java and want to execute them on the DB.  As
I don't have a iBatis-map for these (they are build dynamically) what is the
best way to execute the statements on the db. the SqlMapClient does not have
any kind of execute method. The only thing I came up with at the moment was:

        
client.getDataSource().getConnection().prepareStatement(mysql).executeQuery(
)

Bit nasty...

Any ideas?

Thanks,
Steve.

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.


This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.

<<winmail.dat>>

Reply via email to