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 "supriya .pelluru" <su...@gmail.com> on 2008/04/28 10:33:26 UTC

how can we send the form bean value to the update statement

public void updateInfo(IbatisBooksForm form) {


  int i = 0;

  try {

   int bookid=form.getPrimaryKey();

   HashMap map = new HashMap();

     map.put("bookid",new Integer(form.getPrimaryKey()));

     System.out.println("the bookid value"+bookid);

    // sqlMap.queryForPaginatedList("updateAccount",new
Integer(form.getPrimaryKey()),map);

sqlMap.queryForList("updateAccount",new Integer(form.getPrimaryKey()) );
   System.out.print("the ibatis program 7");

   String author = form.getAuthorname();

   String bookname = form.getBookname();

   String available = form.getAvailablebooks();

   String publisher = form.getPublisher();

   String category = form.getCategory();


   form.setBookname(bookname);
   form.setAuthorname(author);
   form.setAvailablebooks(available);
   form.setPublisher(publisher);
   form.setCategory(category);
  // form.setPrimaryKey(form.getPrimaryKey());



  i = sqlMap.update("updateAccount",form );

  } catch (SQLException e) {


  e.printStackTrace();


  }



  }


For this sql query is

<update id="updateAccount"  parameterClass="booksform">


update IBATISADMINBOOK set BOOKNAME = #bookname#,

AUTHORNAME  =#authorname#,

AVAILABLEBOOKS=#availablebooks#,

PUBLISHER=#publisher#,

CATEGORY=#category#


 where BOOKID =?

</update>


<parameterMap id="update"   class="java.util.HashMap">


 <parameter property="bookid"  jdbcType="NUMBER"

            javaType="java.lang.Integer"  mode="IN" />

</parameterMap>


here i am not getting that how to pass bookid value to update statement

i am getting error like this

the ibatis program 7com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in SqlMap.xml.
--- The error occurred while applying a parameter map.
--- Check the updateAccount-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ORA-01008: not all variables bound


if any one know solution for this problem plz send me  reply