I have 3 classes that are:
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public abstract class Tag {
@Id
private String id;
private String name;
}
@Entity
@Table(uniqueConstraints=
@UniqueConstraint(columnNames={"name"}))
public class SystemTag extends Tag {
}
@Entity
@Table(uniqueConstraints=
@UniqueConstraint(columnNames = {"name", "user"}))
public class CustomTag extends Tag{
@ManyToOne
private User user;
}
so I want to use unique name for system tags, and unique name-user pair for custom tags (multiple users can create same tags) But I get two warnings as below:
<timestamp> WARN AnnotationBinder:601 - HHH000139: Illegal use of @Table in a subclass of a SINGLE_TABLE hierarchy: <domain>.CustomTag
<timestamp> WARN AnnotationBinder:601 - HHH000139: Illegal use of @Table in a subclass of a SINGLE_TABLE hierarchy: <domain>.SystemTag
And it allows me to create two system tags with same name and two custom tags with same name for same user.
How can I handle this?