vladmihalcea / hypersistence-optimizer

Hypersistence Optimizer allows you to get the most out of JPA and Hibernate. By scanning your application configuration and mappings, Hypersistence Optimizer can tell you what changes you need to do to speed up your data access layer.
https://vladmihalcea.com/hypersistence-optimizer/
Apache License 2.0
306 stars 43 forks source link

Ignore Events triggered by default Envers entities #173

Closed vladmihalcea closed 2 years ago

vladmihalcea commented 2 years ago

Envers creates the revision entities, which might trigger the following issues:

ERROR [main]: Hypersistence Optimizer - CRITICAL - IdentityGeneratorEvent - The [id] identifier attribute in the [org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity] entity uses the [IdentityGenerator] strategy, which prevents Hibernate from enabling JDBC batch inserts. Consider using the SEQUENCE identifier strategy instead. For more info about this event, check out this User Guide link - https://vladmihalcea.com/hypersistence-optimizer/docs/user-guide/#IdentityGeneratorEvent

INFO  [main]: Hypersistence Optimizer - MINOR - PrimitiveIdentifierEvent - The [id] identifier attribute in the [org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity] entity uses a primitive type [int]. Consider using a Wrapper instead [java.lang.Integer]. For more info about this event, check out this User Guide link - https://vladmihalcea.com/hypersistence-optimizer/docs/user-guide/#PrimitiveIdentifierEvent

ERROR [main]: Hypersistence Optimizer - CRITICAL - EagerFetchingEvent - The [modifiedEntityNames] attribute in the [org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity] entity uses eager fetching. Consider using lazy fetching which, not only that is more efficient, but is way more flexible when it comes to fetching data. For more info about this event, check out this User Guide link - https://vladmihalcea.com/hypersistence-optimizer/docs/user-guide/#EagerFetchingEvent

WARN  [main]: Hypersistence Optimizer - MAJOR - ElementCollectionEvent - The [modifiedEntityNames] element-collection in the [org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity] entity requires all child operations to be executed from the parent side, hence, if you want to add or remove a child element, you always need to fetch the collection. Consider using a bidirectional one-to-many association instead which allows you to operate on the @ManyToOne side without having to fetch the collection in the parent entity. For more info about this event, check out this User Guide link - https://vladmihalcea.com/hypersistence-optimizer/docs/user-guide/#ElementCollectionEvent

However, since these are default mappings, we should ignore them as the user didn't create them expicitly.

vladmihalcea commented 2 years ago

Fixed.