Skip to content

Incompatibility of TsidGenerator with @ValueGenerationType #782

@mhagnumdw

Description

@mhagnumdw

Since TsidGenerator implements IdentifierGenerator, it cannot be used with @org.hibernate.annotations.ValueGenerationType. Example:

@ValueGenerationType(generatedBy = io.hypersistence.utils.hibernate.id.TsidGenerator.class)
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Inherited
public @interface TsidGeneratorAnnotation {
    EventType[] timing();
}

Error:

Caused by: org.hibernate.AnnotationException: Generator class 'io.hypersistence.utils.hibernate.id.TsidGenerator' implements 'IdentifierGenerator' and may not be used with '@ValueGenerationType'

Expected behavior

The @Tsid annotation works with both identifiers and normal values. Something like:

@Tsid // EventType.INSERT or EventType.UPDATE
@Column(name = "PUBLIC_ID", nullable = false, unique = true, updatable = false)
private Long publicId;

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions