private static void throwDuplicateAnnotationException ( Class < ? > entityClass , Class < ? extends Annotation > annotationClass , PropertyMetadata metadata1 , PropertyMetadata metadata2 ) { String format = "Class %s has at least two fields, %s and %s, with an annotation of %s. " + "A given entity can have at most one field with this annotation. " ; String message = String . format ( format , entityClass . getName ( ) , metadata1 . getName ( ) , metadata2 . getName ( ) , annotationClass . getName ( ) ) ; throw new EntityManagerException ( message ) ; }
Raises an exception with a detailed message reporting that the entity has more than one field that has a specific annotation .