【问题标题】:PostgreSQL with Grails auto increment issuePostgreSQL 与 Grails 自动增量问题
【发布时间】:2012-11-22 03:01:03
【问题描述】:
class abc{

   Integer id
   String name
}   

class xyz {


   Integer id
   Integer project_id
   String name
}

当我保存 abc 对象的对象时,使用一些 id(比如 12 )成功保存,当我保存 xyz 的对象时,它的 id 增量为 (abc.id+1)。

【问题讨论】:

    标签: postgresql grails auto-increment


    【解决方案1】:

    Grails 使用序列 [hibernate_sequence] 为持久保存到数据库的新对象分配 id,您是否要分配不同类型的 id,您应该阅读 grails docs

    【讨论】:

    • 请参阅 Burt 的 this post 以获取复制/粘贴解决方案。
    猜你喜欢
    • 1970-01-01
    • 2017-06-22
    • 1970-01-01
    • 2010-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-28
    • 1970-01-01
    相关资源
    最近更新 更多