public void setPartitionKey(Class<?> domainClass, Object key) {
DomainTypeHandler<?> domainTypeHandler = getDomainTypeHandler(domainClass);
String tableName = domainTypeHandler.getTableName();
// if transaction is enlisted, throw a user exception
if (isEnlisted()) {
throw new ClusterJUserException(
local.message("ERR_Set_Partition_Key_After_Enlistment", tableName));
}
// if a partition key has already been set, throw a user exception
if (this.partitionKey != null) {
throw new ClusterJUserException(
local.message("ERR_Set_Partition_Key_Twice", tableName));
}
ValueHandler handler = domainTypeHandler.createKeyValueHandler(key);
this.partitionKey= domainTypeHandler.createPartitionKey(handler);
// if a transaction has already begun, tell the cluster transaction about the key