Exclude or Customize Generated Comments in JPA Metamodel Files

I am using the hibernate-jpamodelgen processor to generate JPA metamodel files in my project. During the build process, warnings are generated for @see comments in the generated code, referencing private fields in the entity classes. Below is an example:

/**
 * @see com.example.MyEntity#privateField
 **/
public static volatile SingularAttribute<MyEntity, SomeType> privateField_;

This causes warnings during the build, as the private field is inaccessible. These warnings pollute the logs and can lead to unnecessary noise in CI/CD pipelines.

Request: Please provide a way to:

  1. Suppress or exclude comments in the generated files.
  2. Configure the generated comments to avoid referencing private fields.

Environment:

  • Hibernate JPAModelGen version: 6.5.2.Final
  • Java version: 21
  • Build tool: Maven

This was already improved in Hibernate ORM 7: more improvements to generated Javadoc in Hibernate Processor · hibernate/hibernate-orm@f474cac · GitHub

As you can see in the documentation, you can provide a list of warnings to suppress via the addSuppressWarningsAnnotation option.

1 Like