掲示板

Proposal: introducing datatype BigDecimal in Service-Builder

thumbnail
13年前 に Jonas X. Yuan によって更新されました。

Proposal: introducing datatype BigDecimal in Service-Builder

Liferay Master 投稿: 993 参加年月日: 07/04/27 最新の投稿
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.,
<column name="field6" type="BigDecimal" convert-null="false" />
<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,

salary DECIMAL(5,2)


constraint-precision: 5
constraint-scale: 2

It can be presented as
<column name="salary" type="BigDecimal" constraint-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
thumbnail
13年前 に Jonas Yuan によって更新されました。

RE: Proposal: introducing datatype BigDecimal in Service-Builder

Liferay Master 投稿: 993 参加年月日: 07/04/27 最新の投稿
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".
11年前 に Vichantri Geiantilal によって更新されました。

RE: Proposal: introducing datatype BigDecimal in Service-Builder

Junior Member 投稿: 29 参加年月日: 12/06/11 最新の投稿
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?
thumbnail
11年前 に Mika Koivisto によって更新されました。

RE: Proposal: introducing datatype BigDecimal in Service-Builder

Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
You are trying to use something that doesn't exist.
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: Proposal: introducing datatype BigDecimal in Service-Builder

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Yuan just brought it up as a proposal. Unfortunately, I don't think there is any schedule to implement it yet.
thumbnail
11年前 に Jonas Yuan によって更新されました。

RE: Proposal: introducing datatype BigDecimal in Service-Builder

Liferay Master 投稿: 993 参加年月日: 07/04/27 最新の投稿
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.
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: Proposal: introducing datatype BigDecimal in Service-Builder

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
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.