I have an entity like this
@Entity
class Foo {
long id;
String name;
Double parent_id;
Double super_parent_id;
}
And i want this 3 column as a unique key like this :
@Table(name = "FOO", uniqueConstraints={
@UniqueConstraint(columnNames = {"name", "parent_id","super_parent_id"})
})
but this 2 column ( parent_id , super_parent_id ) are nullable so if i have this data
name parent_id super_parent_id
my_name 1 NULL
my_name 1 NULL
the jpa
see this two rows difference and it's logical because NULL IS difference from NULL
but i want them to be validate as same row
Any suggestion ?. Thanks