I currently have a query defined in my XML as follows

 

<statement id=”insertQuery” parameterClass=”java.util.Map” remapResults=”true”>

            Insert into table

            Select

                        Address,

                        City,

                        Zip,

                        $name$ as name,

                        $effDate$ as date

            From

                        Table

            Where

                        Id = #id#

</statement>

 

When I call it using the HashMap and set the effDate with java.sql.Date object it throws an exception

That the  value is not compatible with the datatype of the target which is defined in the database as a Date field.

Also based on the documentation I also tried to pass in a java.util.Date instead of the java.sql.Date and it got an error

“An unexpected token was found” and it seemed like it was passing in the String version of the Date field which included the timestamp in the data and it was choking on the : in the timestamp.

 

How should I be passing the effDate to this query?

 

So far I had

HashMap params = new HashMap();

Params.put(“name”,”Value”)

Params.put (“effDate”,effDate) // effDate is an instance of java.sql.Date . Also tried with java.util.Date.

 

What am I doing wrong?

 

Any help will be appreciated.

 

Thanks,

Prathit Bondre

 

Reply via email to