Hi Collin,
So setProduct_id() and setP_sequence() wouldn't work?
Regardless, if I understand the recommeneded iBATIS way of doing
things, your situation would be an excellent case for using
<resultMap>, perhaps something like:
<resultMap id="productResult" class="mypackage.Product">
<result column="product_id" property="id" />
<result column="p_sequence" property="sequence" />
</resultMap>
<select id="products" resultMap="productResult" >
SELECT product_id, p_sequence
FROM Products
</select>
The <resultMap> expects setId() and setSequence() setters on the
Product class. It's a great way to keep database column names from
dictating method names on the Java side of things.
Ted
> -----Original Message-----
> From: Collin Peters [mailto:cadiolis@gmail.com]
> Sent: Friday, March 02, 2007 12:11 PM
> To: user-java@ibatis.apache.org
> Subject: Syntax for getter variables in a POJO
>
> I am trying to figure out the magical syntax for POJO's in
> getter/setters. I have a database column called product_id, another
> called p_sequence. What do these map to in a POJO getter/setter?
> Seems the underscore causes some problems. I have had to do some
> aliases to make them work (i.e. productid, psequence)
>
> Collin
|