0 Replies Latest reply on Jun 6, 2008 8:01 PM by noradtwo

    EmbeddedId

    noradtwo

      I have a table with a unique constraint on 3 columns, two of which can be null.

      private AttributeValuesId id;
      
       @EmbeddedId
       @AttributeOverrides({
       @AttributeOverride(name = "attributeId", column = @Column(name = "ATTRIBUTE_ID", nullable = false, precision = 22, scale = 0)),
       @AttributeOverride(name = "addressId", column = @Column(name = "ADDRESS_ID", precision = 22, scale = 0)),
       @AttributeOverride(name = "domain", column = @Column(name = "DOMAIN", length = 256))})
       @NotNull
       public AttributeValuesId getId() {
       return this.id;
       }
      


      This works fine when there are no null values however when a null value is present, the entity identifier becomes null

      A null value for address_id or domain causesthe superclass entity to treat it as null. Equals() and hashcode() both would not make the entire entity null if one of these values were null.

      Are there annotations I need to include to indicate that null values are allowed?