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 HelpMePlz <su...@gmail.com> on 2008/04/25 16:18:29 UTC
how can send hashmap values to the
public IbatisBooksForm retriveBookDetails(IbatisBooksForm form1) {
IbatisBooksForm form2 =new IbatisBooksForm();
int bookid=form1.getPrimaryKey();
try{
String bookid1 =Integer.toString(form1.getPrimaryKey());
int book2 =form1.getPrimaryKey();
System.out.println("the book id value after change string "+bookid);
HashMap map = new HashMap();
map.put("bookid",new Integer(form1.getPrimaryKey()));
System.out.println("the bookid value"+bookid);
sqlMap.queryForList("getAllBookDetails",map);
String bookname= form1.getBookname();
String authorname= form1.getAuthorname();
String availablebooks= form1.getAvailablebooks();
String publisher=form1.getPublisher();
String category=form1.getCategory();
form2.setBookname(bookname);
form2.setAuthorname(authorname);
form2.setAvailablebooks(availablebooks);
form2.setPublisher(publisher);
form2.setCategory(category);
}
catch(Exception e)
{
System.out.println("the exception is"+e.getMessage());
}
return form2;
}
this is my action class code
for this sqlmap code is
<parameterMap id="productParam" class="java.util.HashMap">
<parameter property="bookid" jdbcType="NUMEBR" javaType="int"
nullValue="-9999999"/>
<parameter property="bookid"/>
</parameterMap>
<select id="getAllUsers" resultClass="booksform"
cacheModel="categoryCache">
select
*
FROM IBATISADMINBOOK
</select>
<select id="getAllBookDetails" parameterMap="productParam"
cacheModel="categoryCache">
select
BOOKNAME as bookname
AUTHORNAME as authorname
AVAILABLEBOOKS as availablebooks
PUBLISHER as publisher
CATEGORY as category
FROM IBATISADMINBOOK where BOOKID =?
</select>
but i am getting this error
The error occurred in SqlMap.xml.
--- The error occurred while applying a parameter map.
--- Check the SqlMap.productParam.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: ORA-00923: FROM keyword not found where
expected
if any one know solution for this please repl;y me
--
View this message in context: http://www.nabble.com/how-can-send-hashmap--values-to-the-%3CparameterMap%3E-tp16895784p16895784.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
RE: how can send hashmap values to the
Posted by Niels Beekman <n....@wis.nl>.
Your SQL SELECT-clause is not valid; you're missing some commas.
Niels
-----Original Message-----
From: HelpMePlz [mailto:supriyanaidupelluru@gmail.com]
Sent: Friday, April 25, 2008 4:18 PM
To: user-java@ibatis.apache.org
Subject: how can send hashmap values to the <parameterMap>
public IbatisBooksForm retriveBookDetails(IbatisBooksForm form1) {
IbatisBooksForm form2 =new IbatisBooksForm();
int bookid=form1.getPrimaryKey();
try{
String bookid1
=Integer.toString(form1.getPrimaryKey());
int book2 =form1.getPrimaryKey();
System.out.println("the book id value after change
string "+bookid);
HashMap map = new HashMap();
map.put("bookid",new Integer(form1.getPrimaryKey()));
System.out.println("the bookid value"+bookid);
sqlMap.queryForList("getAllBookDetails",map);
String bookname= form1.getBookname();
String authorname= form1.getAuthorname();
String availablebooks= form1.getAvailablebooks();
String publisher=form1.getPublisher();
String category=form1.getCategory();
form2.setBookname(bookname);
form2.setAuthorname(authorname);
form2.setAvailablebooks(availablebooks);
form2.setPublisher(publisher);
form2.setCategory(category);
}
catch(Exception e)
{
System.out.println("the exception
is"+e.getMessage());
}
return form2;
}
this is my action class code
for this sqlmap code is
<parameterMap id="productParam" class="java.util.HashMap">
<parameter property="bookid" jdbcType="NUMEBR" javaType="int"
nullValue="-9999999"/>
<parameter property="bookid"/>
</parameterMap>
<select id="getAllUsers" resultClass="booksform"
cacheModel="categoryCache">
select
*
FROM IBATISADMINBOOK
</select>
<select id="getAllBookDetails" parameterMap="productParam"
cacheModel="categoryCache">
select
BOOKNAME as bookname
AUTHORNAME as authorname
AVAILABLEBOOKS as availablebooks
PUBLISHER as publisher
CATEGORY as category
FROM IBATISADMINBOOK where BOOKID =?
</select>
but i am getting this error
The error occurred in SqlMap.xml.
--- The error occurred while applying a parameter map.
--- Check the SqlMap.productParam.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: ORA-00923: FROM keyword not found
where
expected
if any one know solution for this please repl;y me
--
View this message in context:
http://www.nabble.com/how-can-send-hashmap--values-to-the-%3CparameterMa
p%3E-tp16895784p16895784.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.