Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jonas Yuan
Proposal: introducing datatype BigDecimal in Service-Builder
February 10, 2011 5:49 AM
Answer

Jonas Yuan

Rank: Liferay Master

Posts: 993

Join Date: April 26, 2007

Recent Posts

This thread was posted at Supporting datatype BigDecimal in ServiceBuilder. But I think it would be better to re-post it here as a proposal. Hopefully it would get more feedback.

Any application or portlet dealing with currencies should really use the java BigDecimal class. Thus It would be nice for the Service-Builder to support data-type BigDecimal.

Is it Interesting? Hope that you would be able to post your thoughts / ideas, etc.

First of all, let me introduce a proposal as follows.

1) provide data type called big_decimal in service-builder DTD

e.g.,
1<column name="field6" type="BigDecimal" convert-null="false" />
2<column name="field7" type="BigDecimal" convert-null="true" />

It would be better to add two elements for type BigDecimal in service-builder.

constraint-precision: the precision
constraint-scale: the scale

For example,

1salary DECIMAL(5,2)


constraint-precision: 5
constraint-scale: 2

It can be presented as
1<column name="salary" type="BigDecimal"
2constraint-precision=”5” constraint-scale=”2” convert-null="false" />


2) add new data type in Liferay core called BigDecimalType, where specifies default value;

3) map BigDecimal into NUMERIC or DECIMAL as part of SQL scripts

4) map BigDecimal into data type BigDecimalType

In above four steps, we could make data-type BigDecimal supported via Service-Builder.

You may refer to new features Service-Builder improvement for the element convert-null.

Your suggestions?

Thanks

Jonas Yuan

==================
The Author of Liferay Books:
Liferay User Interface Development
Liferay Portal 6 Enterprise Intranets
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
Jonas Yuan
RE: Proposal: introducing datatype BigDecimal in Service-Builder
February 10, 2011 5:48 AM
Answer

Jonas Yuan

Rank: Liferay Master

Posts: 993

Join Date: April 26, 2007

Recent Posts

java.math.BigDecimal

Immutable, arbitrary-precision signed decimal numbers. A BigDecimal consists of an arbitrary precision integer unscaled value and a 32-bit integer scale. If zero or positive, the scale is the number of digits to the right of the decimal point. If negative, the unscaled value of the number is multiplied by ten to the power of the negation of the scale. The value of the number represented by the BigDecimal is therefore (unscaledValue × 10-scale).

The BigDecimal class provides operations for arithmetic, scale manipulation, rounding, comparison, hashing, and format conversion.

In generated models and services, use java.math.BigDecimal to present data type "BigDecimal".
Vichantri Geiantilal
RE: Proposal: introducing datatype BigDecimal in Service-Builder
August 8, 2012 7:23 AM
Answer

Vichantri Geiantilal

Rank: Junior Member

Posts: 29

Join Date: June 11, 2012

Recent Posts

Hello

I am trying to create the datype BigDecima in my service.xml on Liferay IDE on eclipse. I am trying to understand the folowing link http://www.liferay.com/es/web/jonas.yuan/blog/-/blogs/bringing-data-type-bigdecimal-into-service-builder but i dnt w whicjh file i hv to change or wich file i v to create i just have created my service.xml entity
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="com.dados.slayer">
<author>vi</author>
<namespace>SBInfo</namespace>
<entity name="SInfo" local-service="true" table="INFO" remote-service="false"
data-source="myDatasource">
<column name="ID_INFO" type="long" primary="true"></column>
<column name="TA" type="BigDecimal" constraint-precision="30" constraint-scale="2"></column>
<column name="DF" type="BigDecimal" constraint-precision="30" constraint-scale="2" convert-null="true"></column>
</entity>
</service-builder>


What i hv to do next? this properties constraint-precision="30" constraint-scale="2" are given me error, i did not ye build the service so it can generate other files.

PLease can anyone help me?
Mika Koivisto
RE: Proposal: introducing datatype BigDecimal in Service-Builder
August 8, 2012 2:13 PM
Answer

Mika Koivisto

Rank: Liferay Legend

Posts: 1518

Join Date: August 7, 2006

Recent Posts

You are trying to use something that doesn't exist.
Hitoshi Ozawa
RE: Proposal: introducing datatype BigDecimal in Service-Builder
August 8, 2012 2:40 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Yuan just brought it up as a proposal. Unfortunately, I don't think there is any schedule to implement it yet.
Jonas Yuan
RE: Proposal: introducing datatype BigDecimal in Service-Builder
November 24, 2012 10:10 AM
Answer

Jonas Yuan

Rank: Liferay Master

Posts: 993

Join Date: April 26, 2007

Recent Posts

Hi Vichantri,

This is a new feature. It is still in design phase. refer to Service-Builder improvement.

Thanks to @Mika and @Hitoshi

It would be nice that you could raise your comments / suggestions / feedback.
Hitoshi Ozawa
RE: Proposal: introducing datatype BigDecimal in Service-Builder
November 25, 2012 1:48 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Jonas, I agree with your proposal. I don't think it'll require too much time to implement it. I think the priority level is lowered because liferay.com doesn't need it for their projects.
It may just be easier to fork out.