private void validateGeneratedValueAnnotation ( final Class < ? > clazz , Field field ) { Table table = clazz . getAnnotation ( Table . class ) ; // Still we need to validate for this after post metadata // population. if ( table != null ) { String schemaName = table . schema ( ) ; if ( schemaName != null && schemaName . indexOf ( ' ' ) > 0 ) { schemaName = schemaName . substring ( 0 , schemaName . indexOf ( ' ' ) ) ; GeneratedValue generatedValue = field . getAnnotation ( GeneratedValue . class ) ; if ( generatedValue != null && generatedValue . generator ( ) != null && ! generatedValue . generator ( ) . isEmpty ( ) ) { if ( ! ( field . isAnnotationPresent ( TableGenerator . class ) || field . isAnnotationPresent ( SequenceGenerator . class ) || clazz . isAnnotationPresent ( TableGenerator . class ) || clazz . isAnnotationPresent ( SequenceGenerator . class ) ) ) { throw new IllegalArgumentException ( "Unknown Id.generator: " + generatedValue . generator ( ) ) ; } else { checkForGenerator ( clazz , field , generatedValue , schemaName ) ; } } } } }
validate generated value annotation if given .