sql/domain class error, it tries to convert string to int with no reason

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

sql/domain class error, it tries to convert string to int with no reason

mjfan80
I don't know why, but since some days, grails have some strange iussue with some query

I have this class:


class VImpComponenti implements Serializable{
    static mapping = {
        table "v_imp_componenti"
        id composite: ["tabella", "id0", "idImp"], generator: "assigned", insertable: false, updateable: false
        cache usage: 'read-only'
        version false
        idOri column: "id", insertable: false, updateable: false
    }

    Integer idProduttore
    Integer idModello
    String tabella
    Integer id0
    String idOri
    String descr
    String produt
    String mod
    Date dt
    Date dtFine
    Integer pos
    String idImp
    String idImpOgg



    static constraints = {
        idProduttore nullable: true
        idModello nullable:true
        tabella nullable: false, size:1..36
        idOri nullable: true
        id nullable: true, size:0..60
        descr nullable: true, size:0..1024
        produt nullable: true, size: 0..60
        mod nullable: true, size: 0..100
        dt nullable: true
        dtFine nullable: true
        pos nullable: true
        idImp nullable: true, size: 0..16
        idImpOgg nullable: true, size: 0..16
    }


    public String toString(){
        return "tavella: ${tabella}, id0: ${id0}, idImp: ${idImp}"
    }


when i try to do a query that involve idImp (mapped as a string) i get this error

ERROR util.JDBCExceptionReporter Conversion failed when converting the varchar value '08.59.33.072/A' to data type int.


the valus '08.59...' is a correct value that the database have
the translation of this example query
def comp2 = VImpComponenti.findAllByIdImpOggAndDtFineIsNull(idimp)
is (i log the sql)
select
        this_.tabella as tabella41_0_,
        this_.id0 as id2_41_0_,
        this_.descr as descr41_0_,
        this_.dt as dt41_0_,
        this_.dt_fine as dt5_41_0_,
        this_.id_imp as id6_41_0_,
        this_.id_imp_ogg as id7_41_0_,
        this_.id_modello as id8_41_0_,
        this_.id as id41_0_,
        this_.id_produttore as id10_41_0_,
        this_.mod as mod41_0_,
        this_.pos as pos41_0_,
        this_.produt as produt41_0_ 
    from
        v_imp_componenti this_ 
    where
        this_.id_imp=? 
        and this_.dt_fine is null
and this is a valid query (if i try this query directly in sql it works)

but then i get the error above


why????
What is happened?
Some days ago the query was working good!!!