hybris中将double改为Double

时间:2017-07-11 14:36:31

标签: java hybris

我需要在hybris typeSystem中将字段从double更改为Double,并且想知道它是否实际创建了一个新的数据库字段,或者只是更改了app层中的类型。 提前谢谢。

2 个答案:

答案 0 :(得分:1)

在items.xml更改和系统更新后,数据库字段保持相同的类型。所有读取和写入都来自同一列。所以,我的问题的答案是否定的,列类型在数据库中不会改变。只有应用程序层(模型)将字段从double更改为Double。

答案 1 :(得分:0)

You have the mapping in core-advanced-deployment.xml.

The mapping depends on DB :

    <type-mapping type="java.lang.Double" persistence-type="decimal(30,8)" />
    <type-mapping type="double" persistence-type="decimal(30,8) DEFAULT 0" />

or:

    <type-mapping type="java.lang.Double" persistence-type="double"  />
    <type-mapping type="double" persistence-type="double default 0"  />

or:

     <type-mapping type="java.lang.Double" persistence-type="float" />
     <type-mapping type="double" persistence-type="float default 0" />

So you see that it's currently map that's why you can do that and you don't see change in the DB.

Note that changing a type is strongly discouraged because you can switch to uncompatble type. For instance if you have a column of String you can't migrate it to Number for example because a string is not always parseable in a number.