Unique two-column constraint Combination in active objects
I am developing Active Objects and have 4 columns in my table. I have a requirement where I need to set a constraint so that the combination of two columns is always unique.
@Table("TEST")
@Preload("*")
public interface TestEntity extends RawEntity<Long>{
@AutoIncrement
@NotNull
@PrimaryKey("ID")
Long getID();
@NotNull
Long getItemId();
@NotNull
String getItemName();
@StringLength(767)
String getDescription();
void setItemId(Long itemId);
void setItemName(String itemName);
void setDescription(String description);
}
The requirement here is that the combination of ItemId and ItemName must have a unique constraint.
I tried to do some searches but was able to find a way to make the single column unique using the net.java.ao.schema.Unique class.
Can anyone point me in the right direction on how this can be achieved.
thank
+3
source to share