Not really, but the keys are guaranteed to be unique, and you can set the key of your entity as an arbitrary string. You can use this to create a unique key when saving an object to the data warehouse. For instance,
public class Entity implements Serializable { @Id String id; String unique_together_1; String unique_together_2; public Entity (String unique_together_1, String unique_together_2) { this.id = unique_together_1 + "-" + unique_together_2; this.unique_together_1 = unique_together_1; this.unique_together_2 = unique_together_2; }
Obviously, this will not work if the unique fields of your object change later or if you need several unique restrictions for one type of entity.
source share