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.Schroede..
freenet-ag.de> An
<cayenne-use..ncubator.apache.or
15.01.2007 13:34 g>
Kopie
Bitte antworten Thema
an AW: Problem writing
cayenne-use..ncu 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.Esk..i-de.com [mailto:Florian.Eska@gi-de.com]
Gesendet: Montag, 15. Januar 2007 11:51
An: cayenne-use..ncubator.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
This archive was generated by hypermail 2.0.0 : Mon Jan 15 2007 - 08:00:29 EST