ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sreenivas" <ko_srini...@rediffmail.com>
Subject Customizing Parameter mapping
Date Fri, 29 Jul 2005 19:17:43 GMT
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005>Hi All,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005>I have requirement
where a Java Bean has properties of user defined objects.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005>Here is an example
class called Product, where I have a property of type "Category" class. All the properties
of the product object are set &amp; passed to SQLMAP as a parameter class. Having said
that I would like to know syntax to instruct SQLMAP engine, to extract properties not only
from Product class, but also from Category class.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005>Here is XML
snippet:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005>&lt;insert
id="insertInto" parameterClass="com.ic.ro.Product"&gt;<BR>&nbsp;&nbsp;&nbsp;
<STRONG><FONT color=#ff0000>insert into&nbsp;products (product_id, price,
category_id, description)<BR>&nbsp;&nbsp;&nbsp; values (#productId#, #price#,
# #) -- how to extract category_id &amp; description that are part of Category object,
which is another property in Product Bean?<BR></FONT></STRONG>&nbsp;&nbsp;&nbsp;
&lt;/insert&gt;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005>Please see below
bean definitions and let me know your comments &amp; suggestions.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005>Thanks and regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=108563118-29072005>Srini</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>public class Product impements Serializable<BR>{<BR>&nbsp;private
String productId = null;<BR>&nbsp;private int price = 0;<BR>&nbsp;private
Category cat = null;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;public String getProductId()<BR>&nbsp;{<BR>&nbsp;&nbsp;//
TO DO<BR>&nbsp;&nbsp;return productId;<BR>&nbsp;}<BR>&nbsp;public
void setProductId(String productid)<BR>&nbsp;{<BR>&nbsp;&nbsp;// TO
DO<BR>&nbsp;}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;public int getPrice()<BR>&nbsp;{<BR>&nbsp;&nbsp;//
TO DO<BR>&nbsp;&nbsp;return price;<BR>&nbsp;}<BR>&nbsp;public
void setPrice(int price)<BR>&nbsp;{<BR>&nbsp;&nbsp;// TO DO<BR>&nbsp;}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;public Category getCategory()<BR>&nbsp;{<BR>&nbsp;&nbsp;//
TO DO<BR>&nbsp;&nbsp;return cat;<BR>&nbsp;}<BR>&nbsp;public
void setCategory(Category cat)<BR>&nbsp;{<BR>&nbsp;&nbsp;// TO DO<BR>&nbsp;}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>***********&nbsp;&nbsp;&nbsp;&nbsp;
Category.java ******************</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>public class Category<BR>{<BR>&nbsp;private
int categoryId = 0;<BR>&nbsp;private String description = 0;<BR>&nbsp;<BR>&nbsp;public
int getCategoryId()<BR>&nbsp;{<BR>&nbsp;&nbsp;// TO DO<BR>&nbsp;&nbsp;return
categoryId;<BR>&nbsp;}<BR>&nbsp;public void getCategoryId(int cat)<BR>&nbsp;{<BR>&nbsp;&nbsp;//
TO DO<BR>&nbsp;}<BR>&nbsp;public String getDescription()<BR>&nbsp;{<BR>&nbsp;&nbsp;//
TO DO<BR>&nbsp;&nbsp;return description;<BR>&nbsp;}<BR>&nbsp;public
void setDescription(String desc)<BR>&nbsp;{<BR>&nbsp;&nbsp;// TO DO<BR>&nbsp;}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>}<BR></FONT></DIV>
Mime
View raw message