Primary Key Type: int vs long

后端 未结 4 1366
情深已故
情深已故 2020-12-14 06:51

I know some software shops have been burned by using the int type for the primary key of a persistent class. That being said, not all tables grow past 2 billions. As a matte

4条回答
  •  自闭症患者
    2020-12-14 07:48

    I use Integer for my surrogate keys unless I have a need for them to be something else. It is not necessary to always use a Long if you don't have a need for it.

    (I typically use JPA/Hibernate in my projects running against either Oracle 10g or MySQL 5.x databases.)

提交回复
热议问题