You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Philip Chan <pc...@locussystems.com> on 2005/01/13 22:59:10 UTC

why delete by date not working?

Hi

I have this delete statement

java.util.Date now = new Date();
SqlMapClient client = null;
Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
client = SqlMapClientBuilder.buildSqlMapClient(reader);

client.delete("ActivityLog.PurgeDate", now);

Inside sqlmap.xml
	<delete id="ActivityLog.PurgeDate" parameterClass="date">
	<![CDATA[
	delete from activitylog al where where al.exectime <= #exectime#
	]]>
	</delete>

The record never got deleted.

I am using ibatis 2.0.x and oracle 9.

Re: why delete by date not working?

Posted by vi...@staff.mcgill.ca.
Hi Philip,

An other error is that you dont define correctly your parameterClass. It should
be parameterClass="java.util.Date"

V.

Selon Philip Chan <pc...@locussystems.com>:

> Hi
>
> I have this delete statement
>
> java.util.Date now = new Date();
> SqlMapClient client = null;
> Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
> client = SqlMapClientBuilder.buildSqlMapClient(reader);
>
> client.delete("ActivityLog.PurgeDate", now);
>
> Inside sqlmap.xml
> 	<delete id="ActivityLog.PurgeDate" parameterClass="date">
> 	<![CDATA[
> 	delete from activitylog al where where al.exectime <= #exectime#
> 	]]>
> 	</delete>
>
> The record never got deleted.
>
> I am using ibatis 2.0.x and oracle 9.
>



Re: why delete by date not working?

Posted by Prashanth Sukumaran <pr...@yahoo.com>.
Hi Philip,

The best way to fix this problem is to see what the actual SQL is.  
I suggest you try to setup P6Spy.  I feel that P6Spy should be the defacto SQL snooper for any
project.  The best part is it tells you the dynamic sql and also the sql after the substitution. 
It can get any better than that.  There are also other sub project that have spawned using p6spy.
It has saved me a lot of time.

It is also very easy to setup.  Take a look at it.  http://www.p6spy.com/

- Prashanth




--- Philip Chan <pc...@locussystems.com> wrote:

> Hi
> 
> I have this delete statement
> 
> java.util.Date now = new Date();
> SqlMapClient client = null;
> Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
> client = SqlMapClientBuilder.buildSqlMapClient(reader);
> 
> client.delete("ActivityLog.PurgeDate", now);
> 
> Inside sqlmap.xml
> 	<delete id="ActivityLog.PurgeDate" parameterClass="date">
> 	<![CDATA[
> 	delete from activitylog al where where al.exectime <= #exectime#
> 	]]>
> 	</delete>
> 
> The record never got deleted.
> 
> I am using ibatis 2.0.x and oracle 9.
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: why delete by date not working?

Posted by Prashanth Sukumaran <pr...@yahoo.com>.
Hi Philip,

I think you are supposed to have #value# instead of #exectime#.  You can use a paramname other
than "value" if it is passed in a hashmap were the key is "paramname" or a bean where the
"paramname" is the field defined there.

Thanks
Prashanth.

--- Philip Chan <pc...@locussystems.com> wrote:

> Hi
> 
> I have this delete statement
> 
> java.util.Date now = new Date();
> SqlMapClient client = null;
> Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
> client = SqlMapClientBuilder.buildSqlMapClient(reader);
> 
> client.delete("ActivityLog.PurgeDate", now);
> 
> Inside sqlmap.xml
> 	<delete id="ActivityLog.PurgeDate" parameterClass="date">
> 	<![CDATA[
> 	delete from activitylog al where where al.exectime <= #exectime#
> 	]]>
> 	</delete>
> 
> The record never got deleted.
> 
> I am using ibatis 2.0.x and oracle 9.
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com