You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Keng Wong <ke...@verizon.net> on 2001/04/20 20:56:42 UTC

Oracle decimals

I am trying to use the numeric data types for an Oracle 8i table where the
input is 123.45.

I followed some of the schema conventions from database.dtd such as REAL,
NUMERIC, DECIMAL and even updated the db.props such that these data types
matches Oracle types:
NUMERIC = NUMBER
DECIMAL = NUMBER

My table schema:
SALARY	NUMBER(7,2)

My <app>-schema.xml:
<column name="SALARY" size="7,2" type="NUMERIC"/>

I rebuild the BaseEmpPeer classes for this table using 'build.sh project-om'
and the source indicates (in method row2Object):
obj.setSalary(row.getValue(offset+5).asBigDecimal());

The update only takes in integer values. Am I missing something ? Do I have
to add this behaviour into Emp.java ?

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Oracle decimals

Posted by Keng Wong <ke...@verizon.net>.
The sources are correctly created (as far as I can see):

BaseEmpPeer:obj.setSal(row.getValue(offset+5).asBigDecimal());
BaseEmp:public BigDecimal getSal()
BaseEmp:public void setSal(BigDecimal v)
Emp: no additional methods

2 problems:
1) Showing the entries does not show decimals correctly.
Criteria criteria = new Criteria();
return EmpPeer.doSelect(criteria);

2) Updating the entry with a decimal value loses the decimal points. (Eg
123.45 becomes updated as 123 in table)
doUpdate(Rundata data, Context contex) {
Emp entry = new Emp();
data.getParameters().setProperties(entry);
entry.setModified(true):
entry.setNew(false);
entry.save();

The forms for showing and updating the entries mimics the example (Rdf).

-keng


-----Original Message-----
From: jmcnally@earthlink.net [mailto:jmcnally@earthlink.net]On Behalf Of
John McNally
Sent: Friday, April 20, 2001 12:54 PM
To: turbine-user@jakarta.apache.org
Subject: Re: Oracle decimals


Keng Wong wrote:
>
> I am trying to use the numeric data types for an Oracle 8i table where the
> input is 123.45.
>
> I followed some of the schema conventions from database.dtd such as REAL,
> NUMERIC, DECIMAL and even updated the db.props such that these data types
> matches Oracle types:
> NUMERIC = NUMBER
> DECIMAL = NUMBER
>
> My table schema:
> SALARY  NUMBER(7,2)
>
> My <app>-schema.xml:
> <column name="SALARY" size="7,2" type="NUMERIC"/>
>
> I rebuild the BaseEmpPeer classes for this table using 'build.sh
project-om'
> and the source indicates (in method row2Object):
> obj.setSalary(row.getValue(offset+5).asBigDecimal());
>
> The update only takes in integer values. Am I missing something ? Do I
have
> to add this behaviour into Emp.java ?

I am a bit confused.  the obj.setSalary() method only takes an integer?
What does "The update" mean?

john mcnally

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Oracle decimals

Posted by John McNally <jm...@collab.net>.
Keng Wong wrote:
> 
> I am trying to use the numeric data types for an Oracle 8i table where the
> input is 123.45.
> 
> I followed some of the schema conventions from database.dtd such as REAL,
> NUMERIC, DECIMAL and even updated the db.props such that these data types
> matches Oracle types:
> NUMERIC = NUMBER
> DECIMAL = NUMBER
> 
> My table schema:
> SALARY  NUMBER(7,2)
> 
> My <app>-schema.xml:
> <column name="SALARY" size="7,2" type="NUMERIC"/>
> 
> I rebuild the BaseEmpPeer classes for this table using 'build.sh project-om'
> and the source indicates (in method row2Object):
> obj.setSalary(row.getValue(offset+5).asBigDecimal());
> 
> The update only takes in integer values. Am I missing something ? Do I have
> to add this behaviour into Emp.java ?

I am a bit confused.  the obj.setSalary() method only takes an integer? 
What does "The update" mean?

john mcnally

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org