简体   繁体   English

将双点转换为双点

[英]Changing double to Double in hybris

I have a requirement to change a field from double to Double in hybris typeSystem and was wondering if it actually creates a new database field or just changes the type in app layer. 我需要在hybris typeSystem中将字段从double更改为Double,并且想知道它是否实际上创建了新的数据库字段,还是只是在应用程序层中更改了类型。 Thanks in advance. 提前致谢。

After the items.xml change and system update the data base field remained the same type. 在items.xml更改和系统更新之后,数据库字段保持相同的类型。 All reads and write are from the same column. 所有读取和写入均来自同一列。 So, the answer to my question is no, the column type does not change in database. 因此,我的问题的答案是“否”,数据库中的列类型不会更改。 Only the application layer (model) has changed the field from double to Double. 仅应用程序层(模型)已将字段从double更改为Double。

You have the mapping in core-advanced-deployment.xml. 您在core-advanced-deployment.xml中具有映射。

The mapping depends on DB : 映射取决于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. 例如,如果您有一列String,则不能将其迁移到Number,例如,因为字符串并不总是可以在数字中解析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM