Steve Ebersole (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiY2ZlYWZkZjc5...
) / Improvement (
https://hibernate.atlassian.net/browse/HHH-15989?atlOrigin=eyJpIjoiY2ZlYW...
) HHH-15989 (
https://hibernate.atlassian.net/browse/HHH-15989?atlOrigin=eyJpIjoiY2ZlYW...
) Better support for `@SequenceGenerator` and `@TableGenerator` extensions (optimizer,
etc) (
https://hibernate.atlassian.net/browse/HHH-15989?atlOrigin=eyJpIjoiY2ZlYW...
)
Change By: Steve Ebersole (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
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}
(
https://hibernate.atlassian.net/browse/HHH-15989#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15989#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:674e4eb )