private void manageIdentifier(final JavaType javaType,
final AnnotationMetadataBuilder jpaAnnotationBuilder,
final Set<JavaSymbolName> attributesToDeleteIfPresent,
final Table table) {
final JavaType identifierType = getIdentifierType(javaType);
final PhysicalTypeMetadata identifierPhysicalTypeMetadata = getPhysicalTypeMetadata(identifierType);
// Process primary keys and add 'identifierType' attribute
final int pkCount = table.getPrimaryKeyCount();
if (pkCount == 1) {
// Table has one primary key
// Check for redundant, managed identifier class and delete if found
if (isIdentifierDeletable(identifierType)) {
deleteJavaType(identifierType, "the " + table.getName()
+ " table has only one primary key");
}
attributesToDeleteIfPresent
.add(new JavaSymbolName(IDENTIFIER_TYPE));
// We don't need a PK class, so we just tell the
// JpaActiveRecordProvider via IdentifierService the column name,
// field type and field name to use
final List<Identifier> identifiers = getIdentifiersFromPrimaryKeys(table);
identifierResults.put(javaType, identifiers);
}
else if (pkCount == 0 || pkCount > 1) {
// Table has either no primary keys or more than one primary key so
// create a composite key
// Check if identifier class already exists and if not, create it
if (identifierPhysicalTypeMetadata == null
|| !identifierPhysicalTypeMetadata.isValid()
|| identifierPhysicalTypeMetadata
.getMemberHoldingTypeDetails() == null) {
createIdentifierClass(identifierType);
}
jpaAnnotationBuilder.addClassAttribute(IDENTIFIER_TYPE,