class parent
{
public modifier(){
}
}
class child extends parent {
@OptimisticLock(excluded = true)
@Override
public modifier(){
super.modifier();
}
}
As per above example, hibernate doesn’t allow overriding of base property, it takes only base property where @OptimisticLock annotation is not present.
I checked above code and in highlighted code it check property in list and if is already present it will return from there, instead we could allow to override already added property.
Were there any specific challenges or reason for blocking the property override?
If there are no specific challenges and reason then i was planning to implement the functionality. Please let me know your thoughts and suggestion.
Changing semantics of a property throughout the inheritance hierarchy is not possible as that would complicate a lot of the internal logic and require to duplicate attribute information throughout all entity hierarchies.
As shared screenshot with highlighted code, these are 3 maps in addToOneAndIdProperty ,addPropertyAnnotatedWithMapsId, handleProperty and inFlightPropertyDataList one list need to be handle as a impact… if we replace the base property with overridden property, then it should work. it will provide ability to override, which will make it so much easier in some of the inheritance cases.
It’s not that easy. You are just referring to the boot model of Hibernate ORM, but there also is a runtime model that also needs to be adapted. Since attribute information is kept on the level where an attribute is declared, all of the runtime model needs to be changed to duplicate attribute information across the entity hierarchy.