ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: [jira] Created: (IBATIS-170) i am not sure it is a bug!
Date Thu, 14 Jul 2005 11:57:36 GMT
Why are you inserting a date as a string?

<insert id="product.testinsert">
  insert into test (col) values (#value:TIMESTAMP#);
</insert>

long nCurrentTime = System.currentTimeMillis();
Date date = new Date(nCurrentTime);
broker.insert("product.testinsert",date);

That should work just fine.

Larry


On 7/14/05, leo zhang (JIRA) <ibatis-dev@incubator.apache.org> wrote:
> i am not sure it is a bug!
> --------------------------
> 
>          Key: IBATIS-170
>          URL: http://issues.apache.org/jira/browse/IBATIS-170
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: windows xp, professional oracle9i, eclipse
>     Reporter: leo zhang
> 
> 
> i use oralce9i database.
> the table names test;
> CREATE TABLE TEST
> (
>   col  DATE
> );
> 
> sqlmap like this
>   <insert id = "product.testinsert" parameterClass="java.lang.String">
>     insert into test (col) values (to_date('$timestamp$','yyyy-mm-dd hh:mi:ss'));
>   </insert>
> 
> java code like this:
> ......
>      long nCurrentTime = System.currentTimeMillis();
>       Timestamp ts = new Timestamp(nCurrentTime);
>         broker.insert("product.testinsert",ts.toLocaleString());

Mime
View raw message