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 Betto McRose Gamarra <ic...@gmail.com> on 2008/12/03 15:17:03 UTC

blob type support...

hi all
this is the error trace:
==============
Caused by: java.lang.RuntimeException: Error lazy loading result.
Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
py/com/sif/dna/sgc/persistence/sqlmap/sql/RevisionDocumento.xml.
--- The error occurred while applying a result map.
--- Check the RevisionDocumento.getRevisionDocumentoByDocumentoSgcId-AutoResultMap.
--- Check the result mapping for the 'imagen' property.
--- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
could be found to map the property 'imagen' to the column 'IMAGEN'.
One or both of the types, or the combination of types is not
supported.
	at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.loadObject(EnhancedLazyResultLoader.java:139)
	at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.invoke(EnhancedLazyResultLoader.java:120)
	at $java.util.Set$$EnhancerByCGLIB$$b291e667.iterator(<generated>)

this is sql statement:
=============
    <sql id="searchAll">
        SELECT
            RD.ID                AS id,
            RD.ID_DOCUMENTO      AS idDocumento,
            RD.REVISION          AS revision,
            RD.FECHA_INGRESO     AS fechaIngreso,
            RD.FECHA_INICIO_VIG  AS fechaInicioVigencia,
            RD.IMAGEN            AS imagen,
            RD.APROBADO          AS aprobado,
            RD.ID_ULTIMO_USUARIO AS idUltimoUsuario,
            RD.FECHA_ULTIMA_ACT  AS fechaUltimaAct,
            RD.TRN               AS trn,
            SGC.NOMBRE           AS nombreDocumento,
            SGC.ESTADO           AS estadoCode,
            INFO.ABREVIATURA     AS estadoAbreviatura,
            INFO.DESCRIPCION     AS estadoDescripcion

        FROM REVISION_DOCUMENTO RD,
             DOCUMENTO_SGC SGC,
             INFO_REF_OPC INFO

        WHERE RD.ID_DOCUMENTO = SGC.ID
          AND SGC.ESTADO = INFO.ID
    </sql>

    <select id="getRevisionDocumentoByDocumentoSgcId"
resultClass="revisionDocumento"
            parameterClass="java.lang.Long" >
            <include refid="RevisionDocumento.searchAll"/>
            AND SGC.ID = #id#
    </select>

everything else not showed like class name are correctly defined

as you can see in my <select /> I use resultClass and not resultMap

so, What do I do ?


-- 
Betto McRose Gamarra
IcarusDB
"Soluciones Informáticas"
Cel.: +595 992 686947

Re: HOLD_CURSORS_OVER_COMMIT

Posted by Jeff Butler <je...@gmail.com>.
You can specify some of the values with the "resultSetType" attribute
of the <select> element.  iBATIS currently supports these values:

FORWARD_ONLY
SCROLL_INSENSITIVE
SCROLL_SENSITIVE

Jeff Butler



On Thu, Dec 4, 2008 at 10:00 AM, Ben Shory <be...@sapiens.com> wrote:
> Is there any way to give ibatis some constants for the resultset such as
> HOLD_CURSORS_OVER_COMMIT
> TYPE_FORWARD_ONLY
> CONCUR_READ_ONLY
> ???
>

HOLD_CURSORS_OVER_COMMIT

Posted by Ben Shory <be...@sapiens.com>.
Is there any way to give ibatis some constants for the resultset such as
HOLD_CURSORS_OVER_COMMIT
TYPE_FORWARD_ONLY
CONCUR_READ_ONLY
???

Re: blob type support...

Posted by Betto McRose Gamarra <ic...@gmail.com>.
exclent!

thanks

On Thu, Dec 4, 2008 at 09:04, Jeff Butler <je...@gmail.com> wrote:
> You don't have to use a resultMap.  If you change the type of the
> property in the bean to a byte array (byte[]) it should work
> automatically.
>
> Jeff Butler
>
>
> On Thu, Dec 4, 2008 at 5:55 AM, Betto McRose Gamarra <ic...@gmail.com> wrote:
>> thanks Jeff for your time
>>
>> 1. Blob
>> 2. In my bean I used java.sql.Blob
>>
>> surfing a while in the internet I found a solution for this
>> 1. use a resultMap
>> 2. specify for imagen property
>>    javaType="[B"
>>    jdbcType="BLOB"
>>
>> On Wed, Dec 3, 2008 at 17:02, Jeff Butler <je...@gmail.com> wrote:
>>> The error message states that the database type and the java type are
>>> not compatible with iBATIS default type handling.
>>>
>>> 1. What is the DB field type for IMAGEN?
>>> 2. What is the Java type for the imagen property in the result class?
>>>
>>> Jeff Butler
>>>
>>> On Wed, Dec 3, 2008 at 8:17 AM, Betto McRose Gamarra <ic...@gmail.com> wrote:
>>>> hi all
>>>> this is the error trace:
>>>> ==============
>>>> Caused by: java.lang.RuntimeException: Error lazy loading result.
>>>> Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
>>>> --- The error occurred in
>>>> py/com/sif/dna/sgc/persistence/sqlmap/sql/RevisionDocumento.xml.
>>>> --- The error occurred while applying a result map.
>>>> --- Check the RevisionDocumento.getRevisionDocumentoByDocumentoSgcId-AutoResultMap.
>>>> --- Check the result mapping for the 'imagen' property.
>>>> --- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
>>>> could be found to map the property 'imagen' to the column 'IMAGEN'.
>>>> One or both of the types, or the combination of types is not
>>>> supported.
>>>>        at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.loadObject(EnhancedLazyResultLoader.java:139)
>>>>        at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.invoke(EnhancedLazyResultLoader.java:120)
>>>>        at $java.util.Set$$EnhancerByCGLIB$$b291e667.iterator(<generated>)
>>>>
>>>> this is sql statement:
>>>> =============
>>>>    <sql id="searchAll">
>>>>        SELECT
>>>>            RD.ID                AS id,
>>>>            RD.ID_DOCUMENTO      AS idDocumento,
>>>>            RD.REVISION          AS revision,
>>>>            RD.FECHA_INGRESO     AS fechaIngreso,
>>>>            RD.FECHA_INICIO_VIG  AS fechaInicioVigencia,
>>>>            RD.IMAGEN            AS imagen,
>>>>            RD.APROBADO          AS aprobado,
>>>>            RD.ID_ULTIMO_USUARIO AS idUltimoUsuario,
>>>>            RD.FECHA_ULTIMA_ACT  AS fechaUltimaAct,
>>>>            RD.TRN               AS trn,
>>>>            SGC.NOMBRE           AS nombreDocumento,
>>>>            SGC.ESTADO           AS estadoCode,
>>>>            INFO.ABREVIATURA     AS estadoAbreviatura,
>>>>            INFO.DESCRIPCION     AS estadoDescripcion
>>>>
>>>>        FROM REVISION_DOCUMENTO RD,
>>>>             DOCUMENTO_SGC SGC,
>>>>             INFO_REF_OPC INFO
>>>>
>>>>        WHERE RD.ID_DOCUMENTO = SGC.ID
>>>>          AND SGC.ESTADO = INFO.ID
>>>>    </sql>
>>>>
>>>>    <select id="getRevisionDocumentoByDocumentoSgcId"
>>>> resultClass="revisionDocumento"
>>>>            parameterClass="java.lang.Long" >
>>>>            <include refid="RevisionDocumento.searchAll"/>
>>>>            AND SGC.ID = #id#
>>>>    </select>
>>>>
>>>> everything else not showed like class name are correctly defined
>>>>
>>>> as you can see in my <select /> I use resultClass and not resultMap
>>>>
>>>> so, What do I do ?
>>>>
>>>>
>>>> --
>>>> Betto McRose Gamarra
>>>> IcarusDB
>>>> "Soluciones Informáticas"
>>>> Cel.: +595 992 686947
>>>>
>>>
>>
>>
>>
>> --
>> Betto McRose Gamarra
>> IcarusDB
>> "Soluciones Informáticas"
>> Cel.: +595 992 686947
>>
>



-- 
Betto McRose Gamarra
IcarusDB
"Soluciones Informáticas"
Cel.: +595 992 686947

Re: blob type support...

Posted by Jeff Butler <je...@gmail.com>.
You don't have to use a resultMap.  If you change the type of the
property in the bean to a byte array (byte[]) it should work
automatically.

Jeff Butler


On Thu, Dec 4, 2008 at 5:55 AM, Betto McRose Gamarra <ic...@gmail.com> wrote:
> thanks Jeff for your time
>
> 1. Blob
> 2. In my bean I used java.sql.Blob
>
> surfing a while in the internet I found a solution for this
> 1. use a resultMap
> 2. specify for imagen property
>    javaType="[B"
>    jdbcType="BLOB"
>
> On Wed, Dec 3, 2008 at 17:02, Jeff Butler <je...@gmail.com> wrote:
>> The error message states that the database type and the java type are
>> not compatible with iBATIS default type handling.
>>
>> 1. What is the DB field type for IMAGEN?
>> 2. What is the Java type for the imagen property in the result class?
>>
>> Jeff Butler
>>
>> On Wed, Dec 3, 2008 at 8:17 AM, Betto McRose Gamarra <ic...@gmail.com> wrote:
>>> hi all
>>> this is the error trace:
>>> ==============
>>> Caused by: java.lang.RuntimeException: Error lazy loading result.
>>> Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
>>> --- The error occurred in
>>> py/com/sif/dna/sgc/persistence/sqlmap/sql/RevisionDocumento.xml.
>>> --- The error occurred while applying a result map.
>>> --- Check the RevisionDocumento.getRevisionDocumentoByDocumentoSgcId-AutoResultMap.
>>> --- Check the result mapping for the 'imagen' property.
>>> --- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
>>> could be found to map the property 'imagen' to the column 'IMAGEN'.
>>> One or both of the types, or the combination of types is not
>>> supported.
>>>        at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.loadObject(EnhancedLazyResultLoader.java:139)
>>>        at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.invoke(EnhancedLazyResultLoader.java:120)
>>>        at $java.util.Set$$EnhancerByCGLIB$$b291e667.iterator(<generated>)
>>>
>>> this is sql statement:
>>> =============
>>>    <sql id="searchAll">
>>>        SELECT
>>>            RD.ID                AS id,
>>>            RD.ID_DOCUMENTO      AS idDocumento,
>>>            RD.REVISION          AS revision,
>>>            RD.FECHA_INGRESO     AS fechaIngreso,
>>>            RD.FECHA_INICIO_VIG  AS fechaInicioVigencia,
>>>            RD.IMAGEN            AS imagen,
>>>            RD.APROBADO          AS aprobado,
>>>            RD.ID_ULTIMO_USUARIO AS idUltimoUsuario,
>>>            RD.FECHA_ULTIMA_ACT  AS fechaUltimaAct,
>>>            RD.TRN               AS trn,
>>>            SGC.NOMBRE           AS nombreDocumento,
>>>            SGC.ESTADO           AS estadoCode,
>>>            INFO.ABREVIATURA     AS estadoAbreviatura,
>>>            INFO.DESCRIPCION     AS estadoDescripcion
>>>
>>>        FROM REVISION_DOCUMENTO RD,
>>>             DOCUMENTO_SGC SGC,
>>>             INFO_REF_OPC INFO
>>>
>>>        WHERE RD.ID_DOCUMENTO = SGC.ID
>>>          AND SGC.ESTADO = INFO.ID
>>>    </sql>
>>>
>>>    <select id="getRevisionDocumentoByDocumentoSgcId"
>>> resultClass="revisionDocumento"
>>>            parameterClass="java.lang.Long" >
>>>            <include refid="RevisionDocumento.searchAll"/>
>>>            AND SGC.ID = #id#
>>>    </select>
>>>
>>> everything else not showed like class name are correctly defined
>>>
>>> as you can see in my <select /> I use resultClass and not resultMap
>>>
>>> so, What do I do ?
>>>
>>>
>>> --
>>> Betto McRose Gamarra
>>> IcarusDB
>>> "Soluciones Informáticas"
>>> Cel.: +595 992 686947
>>>
>>
>
>
>
> --
> Betto McRose Gamarra
> IcarusDB
> "Soluciones Informáticas"
> Cel.: +595 992 686947
>

Re: blob type support...

Posted by Betto McRose Gamarra <ic...@gmail.com>.
thanks Jeff for your time

1. Blob
2. In my bean I used java.sql.Blob

surfing a while in the internet I found a solution for this
1. use a resultMap
2. specify for imagen property
    javaType="[B"
    jdbcType="BLOB"

On Wed, Dec 3, 2008 at 17:02, Jeff Butler <je...@gmail.com> wrote:
> The error message states that the database type and the java type are
> not compatible with iBATIS default type handling.
>
> 1. What is the DB field type for IMAGEN?
> 2. What is the Java type for the imagen property in the result class?
>
> Jeff Butler
>
> On Wed, Dec 3, 2008 at 8:17 AM, Betto McRose Gamarra <ic...@gmail.com> wrote:
>> hi all
>> this is the error trace:
>> ==============
>> Caused by: java.lang.RuntimeException: Error lazy loading result.
>> Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
>> --- The error occurred in
>> py/com/sif/dna/sgc/persistence/sqlmap/sql/RevisionDocumento.xml.
>> --- The error occurred while applying a result map.
>> --- Check the RevisionDocumento.getRevisionDocumentoByDocumentoSgcId-AutoResultMap.
>> --- Check the result mapping for the 'imagen' property.
>> --- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
>> could be found to map the property 'imagen' to the column 'IMAGEN'.
>> One or both of the types, or the combination of types is not
>> supported.
>>        at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.loadObject(EnhancedLazyResultLoader.java:139)
>>        at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.invoke(EnhancedLazyResultLoader.java:120)
>>        at $java.util.Set$$EnhancerByCGLIB$$b291e667.iterator(<generated>)
>>
>> this is sql statement:
>> =============
>>    <sql id="searchAll">
>>        SELECT
>>            RD.ID                AS id,
>>            RD.ID_DOCUMENTO      AS idDocumento,
>>            RD.REVISION          AS revision,
>>            RD.FECHA_INGRESO     AS fechaIngreso,
>>            RD.FECHA_INICIO_VIG  AS fechaInicioVigencia,
>>            RD.IMAGEN            AS imagen,
>>            RD.APROBADO          AS aprobado,
>>            RD.ID_ULTIMO_USUARIO AS idUltimoUsuario,
>>            RD.FECHA_ULTIMA_ACT  AS fechaUltimaAct,
>>            RD.TRN               AS trn,
>>            SGC.NOMBRE           AS nombreDocumento,
>>            SGC.ESTADO           AS estadoCode,
>>            INFO.ABREVIATURA     AS estadoAbreviatura,
>>            INFO.DESCRIPCION     AS estadoDescripcion
>>
>>        FROM REVISION_DOCUMENTO RD,
>>             DOCUMENTO_SGC SGC,
>>             INFO_REF_OPC INFO
>>
>>        WHERE RD.ID_DOCUMENTO = SGC.ID
>>          AND SGC.ESTADO = INFO.ID
>>    </sql>
>>
>>    <select id="getRevisionDocumentoByDocumentoSgcId"
>> resultClass="revisionDocumento"
>>            parameterClass="java.lang.Long" >
>>            <include refid="RevisionDocumento.searchAll"/>
>>            AND SGC.ID = #id#
>>    </select>
>>
>> everything else not showed like class name are correctly defined
>>
>> as you can see in my <select /> I use resultClass and not resultMap
>>
>> so, What do I do ?
>>
>>
>> --
>> Betto McRose Gamarra
>> IcarusDB
>> "Soluciones Informáticas"
>> Cel.: +595 992 686947
>>
>



-- 
Betto McRose Gamarra
IcarusDB
"Soluciones Informáticas"
Cel.: +595 992 686947

Re: blob type support...

Posted by Jeff Butler <je...@gmail.com>.
The error message states that the database type and the java type are
not compatible with iBATIS default type handling.

1. What is the DB field type for IMAGEN?
2. What is the Java type for the imagen property in the result class?

Jeff Butler

On Wed, Dec 3, 2008 at 8:17 AM, Betto McRose Gamarra <ic...@gmail.com> wrote:
> hi all
> this is the error trace:
> ==============
> Caused by: java.lang.RuntimeException: Error lazy loading result.
> Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in
> py/com/sif/dna/sgc/persistence/sqlmap/sql/RevisionDocumento.xml.
> --- The error occurred while applying a result map.
> --- Check the RevisionDocumento.getRevisionDocumentoByDocumentoSgcId-AutoResultMap.
> --- Check the result mapping for the 'imagen' property.
> --- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
> could be found to map the property 'imagen' to the column 'IMAGEN'.
> One or both of the types, or the combination of types is not
> supported.
>        at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.loadObject(EnhancedLazyResultLoader.java:139)
>        at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.invoke(EnhancedLazyResultLoader.java:120)
>        at $java.util.Set$$EnhancerByCGLIB$$b291e667.iterator(<generated>)
>
> this is sql statement:
> =============
>    <sql id="searchAll">
>        SELECT
>            RD.ID                AS id,
>            RD.ID_DOCUMENTO      AS idDocumento,
>            RD.REVISION          AS revision,
>            RD.FECHA_INGRESO     AS fechaIngreso,
>            RD.FECHA_INICIO_VIG  AS fechaInicioVigencia,
>            RD.IMAGEN            AS imagen,
>            RD.APROBADO          AS aprobado,
>            RD.ID_ULTIMO_USUARIO AS idUltimoUsuario,
>            RD.FECHA_ULTIMA_ACT  AS fechaUltimaAct,
>            RD.TRN               AS trn,
>            SGC.NOMBRE           AS nombreDocumento,
>            SGC.ESTADO           AS estadoCode,
>            INFO.ABREVIATURA     AS estadoAbreviatura,
>            INFO.DESCRIPCION     AS estadoDescripcion
>
>        FROM REVISION_DOCUMENTO RD,
>             DOCUMENTO_SGC SGC,
>             INFO_REF_OPC INFO
>
>        WHERE RD.ID_DOCUMENTO = SGC.ID
>          AND SGC.ESTADO = INFO.ID
>    </sql>
>
>    <select id="getRevisionDocumentoByDocumentoSgcId"
> resultClass="revisionDocumento"
>            parameterClass="java.lang.Long" >
>            <include refid="RevisionDocumento.searchAll"/>
>            AND SGC.ID = #id#
>    </select>
>
> everything else not showed like class name are correctly defined
>
> as you can see in my <select /> I use resultClass and not resultMap
>
> so, What do I do ?
>
>
> --
> Betto McRose Gamarra
> IcarusDB
> "Soluciones Informáticas"
> Cel.: +595 992 686947
>