Hi Srinivas
Read the IBatis documentation on SQL Maps and you will find it there. It has
exactly what you
want.
Rgds
Prashanth.
--- sreenivas <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have requirement where a Java Bean has properties of user defined objects.
>
> 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 & 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.
>
> Here is XML snippet:
>
> <insert id="insertInto" parameterClass="com.ic.ro.Product">
> insert into products (product_id, price, category_id, description)
> values (#productId#, #price#, # #) -- how to extract category_id &
> description that are part
> of Category object, which is another property in Product Bean?
> </insert>
>
> Please see below bean definitions and let me know your comments & suggestions.
>
> Thanks and regards,
> Srini
>
> public class Product impements Serializable
> {
> private String productId = null;
> private int price = 0;
> private Category cat = null;
>
> public String getProductId()
> {
> // TO DO
> return productId;
> }
> public void setProductId(String productid)
> {
> // TO DO
> }
>
> public int getPrice()
> {
> // TO DO
> return price;
> }
> public void setPrice(int price)
> {
> // TO DO
> }
>
> public Category getCategory()
> {
> // TO DO
> return cat;
> }
> public void setCategory(Category cat)
> {
> // TO DO
> }
>
> }
>
> *********** Category.java ******************
>
> public class Category
> {
> private int categoryId = 0;
> private String description = 0;
>
> public int getCategoryId()
> {
> // TO DO
> return categoryId;
> }
> public void getCategoryId(int cat)
> {
> // TO DO
> }
> public String getDescription()
> {
> // TO DO
> return description;
> }
> public void setDescription(String desc)
> {
> // TO DO
> }
>
> }
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs