I just ran into an issue where EntityBinding.getOptimisticLockMode() returns an 
ordinal from a org.hibernate.annotations.OptimisticLockType enum that is 
inconsistent with the static constants in 
org.hibernate.engine.internal.Versioning.

Jira issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6362

I'm not clear on what conventions there are for enums that are source-specific.

My preference would be to:

1) Extract the static constants for version type from 
org.hibernate.engine.internal.Versioning into a new enum that is an SPI, 
org.hibernate.engine.spi.OptimisticLockMode.

2) Change EntityBinding.getOptimisticLockMode() and 
EntityBindingState.getOptimisticLockMode() to return 
org.hibernate.engine.spi.OptimisticLockMode.

3) Change sources to be responsible for converting from a source-specific value 
to org.hibernate.engine.spi.OptimisticLockMode.

In the same vein, I see there is org.hibernate.metamodel.binding.CascadeType, 
which is not source-specific. In that class, there's a TODO to integrate it 
with org.hibernate.engine.spi.CascadeStyle.

I also see that AttributeBindingState.getCascadeTypes() returns 
Set<CascadeType>.

My preference would be to remove org.hibernate.metamodel.binding.CascadeType 
and to change AttributeBindingState.getCascadeTypes() and 
AbstractAttributeBinding.getCascadeTypes() to:

org.hibernate.engine.spi.CascadeStyle getCascadeStyle();
 
Comments?

Gail
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to