In-line Make it easier to specify Hibernate settings -specific configurations for sequence and table id generators .
Currently , as opposed users need to either -
# Use {{@GenericGenerator}} # Supply a custom {{@IdGeneratorType}}
For annotations, this could either be “ Map extensions ” of to the corresponding Jakarta annotation or a “complete” annotation. E.g.,
{noformat}// an extension public @interface TableGeneratorExtension { String name();
// Hibernate-specific config String optimizerName() default ""; . .. } E // complete public @interface TableGenerator { jakarta . g persistence . TableGenerator generator();
// Hibernate-specific config String optimizerName() default ""; ... } {noformat}
Also, in orm.xsd:
{noformat} <xsd:complexType name="sequence-generator"> <!- Standard JPA attributes --> <xsd:attribute name="name" type="xsd:string" use="required"/> <xsd:attribute name="sequence-name" type="xsd:string"/> <xsd:attribute name="catalog" type="xsd:string"/> <xsd:attribute name="schema" type="xsd:string"/> <xsd:attribute name="initial-value" type="xsd:int"/> <xsd:attribute name="allocation-size" type="xsd:int"/> <!-- Extension attributes --> <xsd:attribute name="per-entity " type="xsd:boolean"/> <xsd:attribute name="per - entity- suffix" type="xsd:string"/> <xsd:attribute name="optizer" type="xsd:string"/> < xsd:attribute name="table-value-column" type="xsd:string" / > </ xsd:complexType name="sequence-generator">{noformat}
And corresponding annotations:
{noformat} /** * For use with the standard {@linkplain TableGenerator @TableGenerator} * providing additional Hibernate configuration of the generator * * @see TableGenerator * @see org.hibernate.id.enhanced.TableGenerator * * @author Steve Ebersole */ @Target({ANNOTATION_TYPE, TYPE, METHOD, FIELD}) @Retention(RUNTIME) @Incubating public @interface TableGeneratorExtension { /** * The name of the associated {@linkplain TableGenerator @TableGenerator}. * * @see TableGenerator#name() */ String name();
/** * Specific type of {@linkplain org.hibernate.id.enhanced.Optimizer optimizer} to use, * if any, to optimize access to the underlying table. * * @see org.hibernate.id.enhanced.OptimizerDescriptor * @see org.hibernate.id.enhanced.StandardOptimizerDescriptor */ String optimizerName() default "";
/** * Hibernate's default is to use a single row for all generators mapped to it, * using {@link org.hibernate.id.enhanced.TableGenerator#DEF_SEGMENT_VALUE} * as the {@link org.hibernate.id.enhanced.TableGenerator#DEF_SEGMENT_COLUMN}. * <p/> * This tells Hibernate to instead use a row for each mapped generator. The * entity name mapped to the generator table * * @see org.hibernate.id.enhanced.TableGenerator#CONFIG_PREFER_SEGMENT_PER_ENTITY * @see AvailableSettings#ID_DB_STRUCTURE_NAMING_STRATEGY */ boolean perEntity() default false; }{noformat} |
|