Uploaded image for project: 'Hibernate ORM'
  1. HHH-11596

@OneToOne association with @JoinTable ignores optional attribute

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.9
    • Fix Version/s: 5.2.10
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      Entity A that contains:

      @NotFound(action = NotFoundAction.IGNORE)
        @OneToOne(mappedBy = "a")
        private B b;
      

      Entity B that contains:

      @OneToOne  
        @JoinTable(name = JOIN_TABLE,
            joinColumns = @JoinColumn(name = COLUMN_CASE_PRIMARY_KEY),
            inverseJoinColumns = @JoinColumn(name = COLUMN_CASE_PRIMARY_KEY_SIDE))
        private A a;
      

      Trying persist an object B with a = null causes the following exception

      org.hibernate.PropertyValueException: not-null property references a null or transient value : 
      	at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:92)
      	at org.hibernate.action.internal.AbstractEntityInsertAction.nullifyTransientReferencesIfNotAlready(AbstractEntityInsertAction.java:115)
      	at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:69)
      	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:623)
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: