esolve
V2EX  ›  问与答

JPA/Hibernate 里 @Column 的属性设置和数据库表中字段的属性设置之间的关系?

  •  
  •   esolve · Jan 24, 2018 · 2189 views
    This topic created in 3137 days ago, the information mentioned may be changed or developed.

    譬如 JPA/Hibernate 里

     @Column(name = "foodName", unique = true, nullable = false)
    

    在数据库里,字段 food_name 本身就已经设置了 not null 以及 unique

    那么在 @Column 中还重复设置一次的意义何在?

    如果有冲突的话,以哪个为准?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5255 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 09:11 · PVG 17:11 · LAX 02:11 · JFK 05:11
    ♥ Do have faith in what you're doing.