New posts for Spring and Hibernate
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.ankurm.idgen;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.UUID;
|
||||
import org.hibernate.annotations.UuidGenerator;
|
||||
|
||||
/** @UuidGenerator(style = TIME): a version 1 (Gregorian time) UUID with Hibernate's own layout. Not version 7. */
|
||||
@Entity
|
||||
public class UuidTimeItem {
|
||||
@Id
|
||||
@UuidGenerator(style = UuidGenerator.Style.TIME)
|
||||
private UUID id;
|
||||
private String name;
|
||||
|
||||
public UuidTimeItem() {}
|
||||
|
||||
public UuidTimeItem(String name) { this.name = name; }
|
||||
|
||||
public UUID getId() { return id; }
|
||||
|
||||
public String getName() { return name; }
|
||||
}
|
||||
Reference in New Issue
Block a user