8 minutes
Cut Jakarta EE Startup Times from Seconds to Milliseconds with CRaC
Jakarta EE applications can take anywhere from several seconds to over a minute to start, depending on their size […]
In prior versions of Jakarta EE, the use of UUID as entity ID or database primary key type was a vendor specific feature. So even though you could use it, you had to rely on vendor specific constructs to get the mapping right. With the release of Jakarta EE 10 however, the Jakarta Persistence specification now provides native support for using UUID as entity ID type.
The jakarta.persistence.GenerationType now has a UUID option that indicates to the persistence provider to generate and assign RFC 4122 UUID to the annotated field. The HelloEntity below shows how to use this new feature.
@Entity
public class HelloEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
private UUID id;
private String greeting;
}
The strategy parameter of the @GeneratedValue annotation is passed the GenerationType.UUID type. With this, you now have a vendor neutral, portable way to entity IDs to the UUID type.
Read more of our Jakarta EE content:
Share:
8 minutes
Jakarta EE applications can take anywhere from several seconds to over a minute to start, depending on their size […]
4 minutes
Zero Trust security has moved from buzzword to necessity. The principle is simple: never trust, always verify. But implementing […]
4 minutes
As we kick off the new year, this January edition of The Monthly Catch looks back at everything that […]