cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian.E...@gi-de.com
Subject Antwort: AW: Problem writing java.lang.Long into database
Date Mon, 15 Jan 2007 12:59:40 GMT
Thank's Peter,

this is the solution:
            <db-attribute name="CURRENT_VALUE" type="BIGINT" length="22"/>

The problem was that the old mapping entry with
            <db-attribute name="CURRENT_VALUE" type="INTEGER" length="22"/>
and
            <obj-attribute name="currentValue" type="java.lang.Long"
db-attribute-path="CURRENT_VALUE"/>
will read the long data correct from the database.
Nobody noticed the mapping error until the new value must also be a Long
value.


Florian



                                                                           
             Peter Schröder                                                
             <Peter.Schroeder@                                             
             freenet-ag.de>                                             An 
                                         <cayenne-user@incubator.apache.or 
             15.01.2007 13:34            g>                                
                                                                     Kopie 
                                                                           
              Bitte antworten                                        Thema 
                    an                   AW: Problem writing               
             cayenne-user@incu           java.lang.Long into database      
             bator.apache.org                                              
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




is your db-type according to java.lang.Long ?

should be something like
<db-attribute name="CURRENT_VALUE" type="BIGINT" length="19"/>

-----Urspr√ľngliche Nachricht-----
Von: Florian.Eska@gi-de.com [mailto:Florian.Eska@gi-de.com]
Gesendet: Montag, 15. Januar 2007 11:51
An: cayenne-user@incubator.apache.org
Betreff: Problem writing java.lang.Long into database


Hi,

I have a problem with writing a java.lang.Long into our database.

Example:
I have a value in the database greater than java.lang.Integer.MAX_VALUE,
example 9000000020.
I can read the value correct from the database.

I add 1 to the value (only for the example here), so we have the new value
9000000021 in the Java data object.

After a commit we have the value "410065439" in the database.

This is exactl y the conversion:
      long lo = 9000000021L;
      int val = (int) lo;"

The failure occurs during the write to the database.
I think I have a small mapping problem and could not find the correct way
to map java.lang.Long to our database.
Sorry if a descriptin exist in the documentation, but I didn't found it

Mapping File
      <obj-entity name="Value" className=
"com.gide.pdvcms.bo.commonstore.Value" dbEntityName="VALUES"
            superClassName=
"com.gide.pdvcms.bo.generic.GenericBusinessObject">
        ....
            <obj-attribute name="currentValue" type="java.lang.Long"
db-attribute-path="CURRENT_VALUE"/>
        ....
      </obj-entity>

Environment:
      Oracle 10 g
      cayenne 1.2
      jdk 1.4.2.10

Later I need the same functionality in DB2.

Thanks
Florian




Mime
View raw message