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 Riccetti Eugenio <eu...@PITAGORA.IT> on 2009/02/03 15:16:36 UTC
Ibator..
Hi,
I used ibator to create mapper. I have a table:
ATECO having CHIAVE and DESCR. DESCR is a mediumtext datatype.
I use MySql.
Ibator has generated:
<sqlMap namespace="ATECO" >
<resultMap id="abatorgenerated_AtecoResult" class="it.pitagora.bignet.common.data.Ateco" >
<result column="CHIAVE" property="chiave" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="abatorgenerated_Ateco02ResultWithBLOBs" class="it.pitagora.bignet.common.data.Ateco" extends="ATECO02.abatorgenerated_Ateco02Result" >
<result column="DESCR" property="descr" jdbcType="LONGVARCHAR" />
</resultMap
......
But the class AtecoExample not contain the methods for the column DESCR.
Why ibator not create the methods?
Thanks for your help,
Eugenio
Re: Ibator..
Posted by Jeff Butler <je...@gmail.com>.
That will work, but it's a pretty complex solution for a simple problem.
I think that you could do an override in your configuration to set the
JDBC type to VARCHAR:
<table tableName="ATECO">
<columnOverride column="DESCR" jdbcType="VARCHAR"/>
</table>
Jeff Butler
On Tue, Feb 3, 2009 at 9:42 AM, Iwao AVE! <ha...@gmail.com> wrote:
> Hi Eugenio,
>
> LONGVARCHAR is translated as a BLOB type by ibator.
> To overcome this behavior, create a subclass of IntrospectedColumn
> and specify it in the ibatorContext element.
>
> - MySqlIntrospectedColumn.java
> package yourpkg;
>
> import org.apache.ibatis.ibator.api.IntrospectedColumn;
>
> public class MySqlIntrospectedColumn extends IntrospectedColumn
> {
> @Override
> public boolean isBLOBColumn()
> {
> boolean result = super.isBLOBColumn();
> return result && !"LONGVARCHAR".equals(getJdbcTypeName());
> }
> }
>
> - ibatorConfig.xml
> <ibatorContext
> introspectedColumnImpl="yourpkg.MySqlIntrospectedColumn"
> ... >
>
> HTH,
> Iwao
>
> on 09.2.3 11:16 PM Riccetti Eugenio said the following:
>> Hi,
>> I used ibator to create mapper. I have a table:
>>
>> ATECO having CHIAVE and DESCR. DESCR is a mediumtext datatype.
>> I use MySql.
>>
>> Ibator has generated:
>>
>> <sqlMap namespace="ATECO" >
>>
>> <resultMap id="abatorgenerated_AtecoResult"
>> class="it.pitagora.bignet.common.data.Ateco" >
>>
>> <result column="CHIAVE" property="chiave" jdbcType="VARCHAR" />
>>
>> </resultMap>
>>
>> <resultMap id="abatorgenerated_Ateco02ResultWithBLOBs"
>> class="it.pitagora.bignet.common.data.Ateco"
>> extends="ATECO02.abatorgenerated_Ateco02Result" >
>>
>> <result column="DESCR" property="descr" jdbcType="LONGVARCHAR" />
>>
>> </resultMap
>>
>> ......
>>
>> But the class AtecoExample not contain the methods for the column DESCR.
>>
>> Why ibator not create the methods?
>>
>> Thanks for your help,
>>
>> Eugenio
>>
>
>
Re: Ibator..
Posted by Iwao AVE! <ha...@gmail.com>.
Hi Eugenio,
LONGVARCHAR is translated as a BLOB type by ibator.
To overcome this behavior, create a subclass of IntrospectedColumn
and specify it in the ibatorContext element.
- MySqlIntrospectedColumn.java
package yourpkg;
import org.apache.ibatis.ibator.api.IntrospectedColumn;
public class MySqlIntrospectedColumn extends IntrospectedColumn
{
@Override
public boolean isBLOBColumn()
{
boolean result = super.isBLOBColumn();
return result && !"LONGVARCHAR".equals(getJdbcTypeName());
}
}
- ibatorConfig.xml
<ibatorContext
introspectedColumnImpl="yourpkg.MySqlIntrospectedColumn"
... >
HTH,
Iwao
on 09.2.3 11:16 PM Riccetti Eugenio said the following:
> Hi,
> I used ibator to create mapper. I have a table:
>
> ATECO having CHIAVE and DESCR. DESCR is a mediumtext datatype.
> I use MySql.
>
> Ibator has generated:
>
> <sqlMap namespace="ATECO" >
>
> <resultMap id="abatorgenerated_AtecoResult"
> class="it.pitagora.bignet.common.data.Ateco" >
>
> <result column="CHIAVE" property="chiave" jdbcType="VARCHAR" />
>
> </resultMap>
>
> <resultMap id="abatorgenerated_Ateco02ResultWithBLOBs"
> class="it.pitagora.bignet.common.data.Ateco"
> extends="ATECO02.abatorgenerated_Ateco02Result" >
>
> <result column="DESCR" property="descr" jdbcType="LONGVARCHAR" />
>
> </resultMap
>
> ......
>
> But the class AtecoExample not contain the methods for the column DESCR.
>
> Why ibator not create the methods?
>
> Thanks for your help,
>
> Eugenio
>