ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Road Mountain <roads2wa...@yahoo.com>
Subject Re: Very new to ibatis -- help required.
Date Thu, 09 Feb 2006 12:59:44 GMT
Looks like you are totally new to java world. First read a JSP/Servlets book. I would recommend
you to read SWCD (search in google) book which gives you exposure to all areas. Then read
the iBATIS guides. Trust me, both these take hardly a weekend. Finish that first than start
asking questions!

jayalakshmi.mohanarangam@wipro.com wrote:  


I am very new to struts and ibatis. I am trying to develop a very small
application. I just have jsp
Page (application is developed using struts) which has textbox, which
gets the id. I want to put the value in the variable id into the
microsoft access database using ibatis. That's all.

I have downloaded iBATIS_DBL-2.1.7.597 version. I am using jdk1.5.0_06.
will it be compatible.
I am working with struts 1.2.7.

I have written two xmls
UserForm.xml




PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN">




INSERT INTO PERSON VALUES(#id#)





sqlMap.xml






























I have Person table with id column.

Can anyone tell me where I should extract the ibatis, where should I put
the person.xml and sqlmap.xml;

Regards,
Jayalakshmi.













-----Original Message-----
From: Yusuf [mailto:Yusuf@ekalife.co.id]
Sent: Thursday, February 09, 2006 8:40 AM
To: user-java@ibatis.apache.org
Subject: RE: Different Number of Columns in resultClass with xml and
with HashMap

Hello, regarding my last question, let me simplify this question:
I have a resultMap that contains another select statement that populates
one of the column, If the resultMap contains 10 column, which 2 of them
contains another select statement, then this is what happens:
- if i map the results to a Map or a class, then the result is
correct (10 columns)
- if i use resultMap="xml", then the result is only 8 columns
(without the 2 which contains another select)

have anyone experienced this before? or a bug?

Thanks,
Yusuf.

-----Original Message-----
From: Yusuf
Sent: Tuesday, February 07, 2006 2:02 PM
To: user-java@ibatis.apache.org
Subject: Different Number of Columns in resultClass with xml and with
HashMap


Hi,
I have a working query and the resultmap is like this:


jdbcType="VARCHAR2" nullValue=""/>
jdbcType="VARCHAR2" nullValue=""/>
jdbcType="VARCHAR2" nullValue=""/>
tahunKe=TAHUN_KE}" property="SAR_POLIS" nullValue="0" jdbcType="NUMBER">select="selectChild1"/>
javaType="double" jdbcType="NUMBER" nullValue="0"/>

javaType="double" jdbcType="NUMBER" nullValue="0"
select="selectChild2"/>
javaType="double" jdbcType="NUMBER" nullValue="0"
select="selectChild3"/>


So far there is no problem (all the inner fields also populated with the
selectChild1, selectChild2, ..),
but when i tried changing the resultMap class to xml like this:


jdbcType="VARCHAR2" nullValue=""/>
jdbcType="VARCHAR2" nullValue=""/>
jdbcType="VARCHAR2" nullValue=""/>
tahunKe=TAHUN_KE}" property="SAR_POLIS" nullValue="0" jdbcType="NUMBER">select="selectChild1"/>
javaType="double" jdbcType="NUMBER" nullValue="0"/>

javaType="double" jdbcType="NUMBER" nullValue="0"
select="selectChild2"/>
javaType="double" jdbcType="NUMBER" nullValue="0"
select="selectChild3"/>


and used a custom type handler to process the xml like this (i'm using
dom4j):

static class XmlRowHandler implements RowHandler {
private Document domDocument;
public XmlRowHandler(String xmlResultName) {
domDocument = DocumentHelper.createDocument();
getDomDocument().addElement(xmlResultName);
}
public void handleRow(Object object) {
try {
Document xmlFragment = DocumentHelper
.parseText((String) object);
Element xmlElement =
xmlFragment.getRootElement();

getDomDocument().getRootElement().add(xmlElement);
} catch (DocumentException e) {
}
}
public Document getDomDocument() {
return domDocument;
}
}

private Document queryXml(String queryId, Object param) {
RowHandler rowHandler = new XmlRowHandler("result");
getSqlMapClientTemplate().queryWithRowHandler(queryId, param,
rowHandler);
Document doc = ((XmlRowHandler) rowHandler).getDomDocument();
return doc; 
}

the result is different. Only the columns without inner selects are
shown, so instead of having 7 columns per row, there is only 4 columns
per row. I have used this custom xml handler for other queries and it
ran well.

Is this a bug in ibatis, or I've done something wrong?

Thank you for your help and regards,
Yusuf S.




The information contained in this electronic message and any attachments to this message are
intended for the exclusive use of the addressee(s) and may contain proprietary, confidential
or privileged information. If you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and destroy all copies
of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email
and any attachments for the presence of viruses. The company accepts no liability for any
damage caused by any virus transmitted by this email.

www.wipro.com


			
---------------------------------
 Yahoo! Mail - Helps protect you from nasty viruses.
Mime
View raw message