|
I'd actually like to start on this. And I'd like to try to squeeze it into 4.3.
I am tossing around the idea of re-purposing org.hibernate.annotations.Generated rather than defining a new org.hibernate.annotations.Dynamic annotation. I think that could work if we change the definition I proposed above to:
public @interface Generated {
/**
* @deprecated Use {@link #when} instead
*/
@Deprecated
GenerationTime value();
/**
* The enum value representing when the value is generated.
*/
GenerationTime when() default ALWAYS;
/**
* The generation strategy to use.
*/
Class<? extends DynamicValueGenerator> generator() default void.class;
}
The need for generator() to default to void.class would be necessary to allow existing usage to work. void.class would be interpreted as "just read back the value generated by the DB after INSERT/UPDATE".
Also, I'd like to consider a way to allow generator() to hook in with the org.hibernate.boot.registry.selector.spi.StrategySelector service (aka, DynamicValueGenerator would become a selectable strategy). That would require though the ability to use a String. Would it make the most sense to expose both and just document their mutual-exclusivity? Or just expose the String version (which takes away the type checking for the simple case where you want to specify the DynamicValueGenerator impl class locally)?
|