Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-1071

ANN-824 - MSSQL, DB2, Sybase - Nullable Foreign PK not allowed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.2.0.GA_CP04, 4.3.0.GA_CP02, 4.3.0.GA_CP02_FP01, 4.2.0.GA_CP05, 4.3.0.GA_CP03, 4.3.0.GA_CP03_FP01, 4.2.0.GA_CP06, 4.3.0.GA_CP04, 4.3.0.GA_CP04_FP01, EAP 5.0.0.CR3, EAP 5.0.0.CR4 (FCS and BETA2), EAP 5.0.0.CR5, EAP 5.0.0
    • Fix Version/s: None
    • Component/s: Hibernate
    • Labels:
      None
    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Add "nullable=false" to @JoinColumn
      Add "optional=false" to @ManyToOne
      Add an @AttributeOverride with @Column(name="mapkey", nullable=false) in case of a @CollectionOfElements using a Map
      Add "nullable=false" in @Column when inside a @CollectionId or inside @MapKey

      Show
      Add "nullable=false" to @JoinColumn Add "optional=false" to @ManyToOne Add an @AttributeOverride with @Column(name="mapkey", nullable=false) in case of a @CollectionOfElements using a Map Add "nullable=false" in @Column when inside a @CollectionId or inside @MapKey

      Description

      Foreign PK are not allowed to be nullable in MSSQL, causing the below tests to fail:

      org.hibernate.test.annotations.cid.CompositeIdTest (all)
      org.hibernate.test.annotations.collectionelement.CollectionElementTest (all)
      org.hibernate.test.annotations.identifiercollection.IdentifierCollectionTest.testIdBag
      org.hibernate.test.annotations.indexcoll.IndexedCollectionTest.testRealMap
      org.hibernate.test.annotations.indexcoll.IndexedCollectionTest.testEntityKeyElementTarget
      org.hibernate.test.annotations.manytoone.ManyToOneJoinTest.testManyToOneJoinTable
      org.hibernate.test.annotations.manytoone.ManyToOneJoinTest.testOneToOneJoinTable
      org.hibernate.test.annotations.target.TargetTest.testTargetOnMapKey
      org.hibernate.test.annotations.target.TargetTest.testTargetOnMapKeyManyToMany

      The following changes are necessary to fix the failures:
      Add "nullable=false" to @JoinColumn
      Add "optional=false" to @ManyToOne
      Add an @AttributeOverride with @Column(name="mapkey", nullable=false) in case of a @CollectionOfElements using a Map
      Add "nullable=false" in @Column when inside a @CollectionId or inside @MapKey

      The following models are affected:
      org.hibernate.test.annotations.collectionelement.Boy
      org.hibernate.test.annotations.cid.TvMagazinPk
      org.hibernate.test.annotations.cid.ChildPk
      org.hibernate.test.annotations.identifiercollection.Passport
      org.hibernate.test.annotations.indexcoll.Atmosphere
      org.hibernate.test.annotations.target.Brand

      I could not fix the following model, because it uses the @JoinColumn in inverseJoinColumns, which I suppose can be nullable by design.
      org.hibernate.test.annotations.manytoone.ForestType , biggestRepresentative

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                juraci.costa Juraci Paixão Kröhling
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: