/** * Returns the type of ID that DBRE should use for the given entity * * @param entity the entity for which to get the ID type (required) * @return a non-<code>null</code> ID type */ private JavaType getIdentifierType(final JavaType entity) { final PhysicalTypeMetadata governorPhysicalTypeMetadata = getPhysicalTypeMetadata(entity); if (governorPhysicalTypeMetadata != null) { final ClassOrInterfaceTypeDetails governorTypeDetails = governorPhysicalTypeMetadata.getMemberHoldingTypeDetails(); final AnnotationMetadata jpaAnnotation = getJpaAnnotation(governorTypeDetails); if (jpaAnnotation != null) { final AnnotationAttributeValue<?> identifierTypeAttribute = jpaAnnotation.getAttribute(new JavaSymbolName(IDENTIFIER_TYPE)); if (identifierTypeAttribute != null) { // The identifierType attribute exists, so get its value final JavaType identifierType = (JavaType) identifierTypeAttribute.getValue(); if (identifierType != null && !JdkJavaType.isPartOfJavaLang(identifierType)) { return identifierType; } } } } // The JPA annotation's "identifierType" attribute does not exist or is // not a simple type, so return a default return new JavaType(entity.getFullyQualifiedTypeName() + PRIMARY_KEY_SUFFIX); }