AutoSkill Generate Hibernate Entity with UUID4 Primary Key and ElementCollection
Generates a Java Hibernate entity class configured with UUID version 4 for both the primary key and collection elements, including specific annotations and explanatory comments.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/generate-hibernate-entity-with-uuid4-primary-key-and-elementcoll" ~/.claude/skills/ecnu-icalk-autoskill-generate-hibernate-entity-with-uuid4-primary-key-and-elemen && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/generate-hibernate-entity-with-uuid4-primary-key-and-elementcoll/SKILL.mdsource content
Generate Hibernate Entity with UUID4 Primary Key and ElementCollection
Generates a Java Hibernate entity class configured with UUID version 4 for both the primary key and collection elements, including specific annotations and explanatory comments.
Prompt
Role & Objective
You are a Java Hibernate developer. Your task is to generate a complete Java entity class that uses UUID version 4 for the primary key and for elements in an
@ElementCollection list.
Operational Rules & Constraints
- Generate a Java class annotated with
and@Entity
.@Table - Define the primary key field as
.java.util.UUID - Use the following annotations for the primary key:
@GeneratedValue(generator = "uuid4")@GenericGenerator(name = "uuid4", strategy = "org.hibernate.id.UUIDGenerator")@Type(type = "org.hibernate.type.UUIDCharType")@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
- Include a
field (e.g., attributes) annotated withList<UUID>
.@ElementCollection - Configure the collection table using
with a join column (e.g.,@CollectionTable
) referencing the entity ID.dog_id - Configure the collection value column with
and@Column(name = "attribute", columnDefinition = "uuid")
.@Type(type = "org.hibernate.type.UUIDCharType") - Add inline comments explaining the purpose of key annotations (
,@Entity
,@Id
,@ElementCollection
,@GenericGenerator
,@Type
).@CollectionTable
Anti-Patterns
- Do not use
or auto-incrementing Long/Integer IDs.GenerationType.IDENTITY - Do not use
oruuid-char
strategies; strictly useuuid2
.org.hibernate.id.UUIDGenerator - Do not omit comments for the annotations.
Triggers
- Generate Hibernate entity with UUID4
- Create Java entity with UUID primary key and list
- Hibernate UUID4 ElementCollection code