RE: BigDecimal vs Integer -- StoredProcedure out parameter vs Query

From: Pirola Davide (davide.pirol..tin.it)
Date: Fri Feb 18 2005 - 03:58:18 EST

  • Next message: Borut BolĨin: "[solved ] Re: Initializing DataSourceInfo"

    Maybe my mail is a little bit confuse :-)

    In the first case, i read a record via Stored Procedure (ORACLE CURSOR in out parameter).
    In the second case i use a normal SelectQuery object:

            SelectQuery query = new SelectQuery(MyClass.class);
            ...
            List objects = context.performQuery(query);

    At the end i obtain a java object with this kind of fileds:

            long(or int) id;
            String filed1;
            String filed2;
            ....

    The id, in the first case, is returned as BigDecimal.
    In the second case is returned as Integer.

    So i can't use the same java object... or i must make a supplementary control:

     public int getId() {
            return readProperty("id") instanceof BigDecimal ? ((BigDecimal) readProperty("id")).intValue() : readProperty("id") instanceof Integer ? ((Integer) readProperty("id")).intValue() : 0;
        }

    Anyhow, both StoredProcedure and Select Query (on Oracle) are identical.

    Thank's.
    Davide
            



    -----Original Message-----
    From: Pirola Davide
    Sent: giovedƬ 17 febbraio 2005 17.15
    To: 'cayenne-user@objectstyle.org'
    Subject: BigDecimal vs Integer -- StoredProcedure out parameter vs Query


    Hi,
    i have two way for access to my data in a table.

    1)Stored procedure out parameter.

    2)SelecQuery

    In all the cases this is the query executed :
            
            "SELECT id,field1, field2 ... FROM mytable WHERE id = myvalue"

    When i map this record to my java object, in the first case the id value is returned by cayenne as BigDecimal, in the second case as Integer.

    Why?

    I prefer to use Integer... how i can tell to cayenne to handle oralce number type as Integer value?

    (i have alreay mapped this with java.lang.Integer in data map xml file)



    This archive was generated by hypermail 2.0.0 : Fri Feb 18 2005 - 03:57:33 EST