primaryKey
Description copied from interface:
Entities
Creates a new
Entity.Key
instance of the given entityType, initialised with the given value
Entities entities = domain.entities();
// Create a single-value primary key
Entity.Key customerKey = entities.primaryKey(Customer.TYPE, 42);
// Use the key to fetch an entity
Entity customer = connection.selectSingle(customerKey);
// Keys can be compared
Entity.Key anotherKey = entities.primaryKey(Customer.TYPE, 42);
customerKey.equals(anotherKey); // true
// Null values are allowed
Entity.Key nullKey = entities.primaryKey(Customer.TYPE, null);
- Specified by:
primaryKey
in interfaceEntities
- Type Parameters:
T
- the key value type- Parameters:
entityType
- the entityTypevalue
- the key value, assumes a single value key- Returns:
- a new
Entity.Key
instance