private void inspectId ( ) { if ( entityModel . getIdField ( ) == null ) { // Default to field named "id" List < FieldModel > fields = entityModel . getFields ( ) ; for ( FieldModel f : fields ) { if ( EntityModel . DEFAULT_ID_FIELD . equals ( f . getFieldName ( ) ) ) { entityModel . setIdField ( f ) ; } } } FieldModel idField = entityModel . getIdField ( ) ; if ( idField != null && "long" . equals ( idField . getJavaType ( ) ) ) { return ; } else { abort ( "Entity must contain a field named id or annotated with @Id of type long" ) ; } }
Verifies that the entity has exactly one id field of type long .