diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/id/GenericGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/id/GenericGeneratorTest.java new file mode 100644 index 0000000000..24a8d2bdb5 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/id/GenericGeneratorTest.java @@ -0,0 +1,55 @@ +package org.hibernate.orm.test.id; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.SessionFactory; +import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.Test; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; + +@DomainModel( + annotatedClasses = GenericGeneratorTest.TestEntity.class +) +@SessionFactory +public class GenericGeneratorTest { + + @Test + public void testInsert(SessionFactoryScope scope) { + scope.inTransaction( + session -> { + TestEntity entity = new TestEntity( "1", "test" ); + session.persist( entity ); + } + ); + } + + @Entity(name = "TestEntity") + public static class TestEntity { + @Id + @GeneratedValue(generator = "assigned") + @GenericGenerator(name = "assigned", + strategy = "assigned", + parameters = { + @Parameter(name = "entity_name", + value = "ProductUUID" + ) + } + ) + private String id; + + private String name; + + public TestEntity() { + } + + public TestEntity(String id, String name) { + this.id = id; + this.name = name; + } + } +}