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?


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156442#4156442

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4156442
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to