I am developing with Active Objects and have 4 columns in my table. I have a requirement wherein I have to place a constraint so that combination of two columns will always be 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 ItemId and ItemName combination should have a Unique Constraint.
I tried to do some searching but could only find a way to make a single column unique using net.java.ao.schema.Unique class.
Can someone point me to some right direction on how this can be achieved.
Thanks
After doing some research I found that Active Objects at present does not support this particular feature. So in case you want to use this badly then you might have to modify your approach of storing data.