ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <erlend.bjo...@aftenposten.no>
Subject SV: multiple delete in sqlmap
Date Fri, 15 Jul 2005 14:16:51 GMT
Hi there!

Is it related rows you are trying to delete ?

Then you should define FK's between the NUM_OBJ's 
on the tables and use casade delete, and delete 
the row in the main table (FUN_OBJECT ??) 

    = only one delete statement !!!!

But not sure if MySQL have cascade delete ??


Take care,
Erlend
 


-----Opprinnelig melding-----
Fra: olivier ZILLER [mailto:Olivier.Ziller@univ-nancy2.fr] 
Sendt: 13. juli 2005 17:47
Til: user-java@ibatis.apache.org
Emne: multiple delete in sqlmap


hello,

i'm using sqlmap and mysql and try to execute a delete statement like this :

    <!-- Suppression d'un objet -->
    <delete id="deleteObjet"
        parameterClass="fr.unire.portal.channels.fun.csof.beans.Objet" >
        delete from FUN_ERR_OBJ where NUM_OBJ = #numObj#;
        delete from FUN_INFO_OBJ_LOV where NUM_OBJ = #numObj#;
        delete from FUN_INFO_OBJ where NUM_OBJ = #numObj#;
        delete from FUN_GRP_INFO_OBJ where NUM_OBJ = #numObj#;
        delete from FUN_LANG_OBJ where NUM_OBJ = #numObj#;
        delete from FUN_ARB_OBJ where NUM_FILS_OBJ = #numObj#;
        delete from FUN_CDM_OBJ where NUM_OBJ = #numObj#;
        delete from FUN_PERS_OBJ where NUM_OBJ = #numObj#;
        delete from FUN_OBJET where NUM_OBJ = #numObj#;
    </delete>

but i get this error :

--- The error occurred in /properties/channels/fr_unire/csof/sql-objet.xml.
--- The error occurred while applying a parameter map.
--- Check the deleteObjet-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Syntax error or access violation message from server: "You
have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right
syntax to use near ';         delete from FUN_INFO_OBJ_LOV where NUM_OBJ
= 23;         delete from F' at line 1"
Caused by: java.sql.SQLException: Syntax error or access violation message from server: "You
have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right
syntax to use near ';         delete from FUN_INFO_OBJ_LOV where NUM_OBJ
= 23;         delete from F' at line 1"
    at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:87)
    at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:500)
    at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.delete(SqlMapExecutorDelegate.java:523)
    at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.delete(SqlMapSessionImpl.java:93)
    at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.delete(SqlMapClientImpl.java:65)
    at
fr.unire.portal.channels.fun.csof.dao.ObjetDAO.deleteObjet(ObjetDAO.java:481)
    ... 18 more
Caused by: java.sql.SQLException: Syntax error or access violation message from server: "You
have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right
syntax to use near ';         delete from FUN_INFO_OBJ_LOV where NUM_OBJ
= 23;         delete from F' at line 1"
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2247)
    at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1371)
    at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at
com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:57)
    at $Proxy2.execute(Unknown Source)
    at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:84)
    at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:196)
    at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:74)
    ... 23 more

any idea on how to do that?

regards


-- 
Olivier ZILLER
CRI Gestion
Universite NANCY2
25 rue Baron Louis
BP 454 NANCY CEDEX
tel: 03 54 00 11 12 / 06 85 74 89 77 / poste 604
fax : 03 83 30 05 65

Mime
View raw message