Generate Primary Keys Using JPA and Hibernate
How do you get the primary key values in your application? Do you use natural keys or do you generate technical IDs? I prefer to generate simple, numerical, technical IDs like you can see in the following code snippet instead of using natural keys which often require the combination of multiple attributes. @Id private Long…