Let's say I have an entity like this:
@Entity
public Foo {
@Id
private Long id;
private String name;
private String type;
...
}
Is there a way to express that name and type should be unique together? Meaning that for example you could have name "x" with type "y" and name "x" with type "z", but not an other "x" with type "y".
@EmbeddedId doesn't do the trick since name can be changed later - type however remains the same throughout the lifecycle of the entity.