实体成员应该是原始数据类型还是java数据类型? [英] Entity members should they be primitive data types or java data types?
本文介绍了实体成员应该是原始数据类型还是java数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将启用的变量声明为布尔值还是布尔值有区别吗?从内存占用的角度来看,这是更可取的.
Is there a difference in declaring the enabled variable as Boolean or boolean? Which is preferable from a memory footprint perspective.
@Entity
class User {
@Column
Boolean enabled;
}
推荐答案
它们都将映射到相同的列类型.从内存的角度来看,一个原语可能会更轻一些,但是几乎可以肯定的区别是可以忽略不计的.我认为原语会使它不可为空,但是您也可以使用批注来做到这一点.
They'll both map to the same column type. From a memory perspective, a primitive would probably be a little lighter, but the difference is almost certainly going to be negligible. I think a primitive would make it non-nullable, but you could also do that with an annotation.
这篇关于实体成员应该是原始数据类型还是java数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文