Description
Expected Behavior
The class org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest
should have proper equals
and hashCode
methods.
Current Behavior
The class does not have an overriden equals
or hashCode
method which makes proper comparison of two instances difficult.
Context
I save this class into a database and read it back with JPA and Hibernate. This is done in some customization of the project:
spring-authorization-server
.
However, Hibernate has the funcationality to detect changes in an entity and send an update to this entity to the database. For this function the equals
method of custom types is called. Hibernate holds a copy of the entity in cache and compare this one with the one delivered to the application.
Because of the missing proper equals
method of the given class an update is triggered everytime the entity is read from the database.
I understand that this may be a special case in comibnation with Hibernate but the lack of the method ensures that comparisons are maybe not accurate enough.
Workaround
To prevent this issue i wrap a custom datatype around the OAuth2AuthorizationRequest
which adds the missing equals
functionality.