Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有一个域类,我设置为int userID. 当自动编号变得非常大而User.findById()引发错误时,它会影响吗?如果我现在更改为 Long(人们已经在使用该应用程序)会影响findById()吗?
int userID
User.findById()
findById()
findById()会工作得很好。
真正的问题是在向表中插入新数据时,如果 id 是自动生成的,它很可能会在达到最大值时重新启动,这可能导致重复的 id,从而导致错误。
通常,当应用程序已经投入生产并且数据库已填充时,更改架构定义并不容易。如果您尝试在 Grails 中执行此操作,则可能会丢失数据库中的信息。因此,请在尝试任何操作之前进行备份。