Tutorial by Examples

@Entity class Note { @Id Integer id; @Basic String note; @Basic int count; } Getters, setters etc. are ommitted for brevity, but they are not needed for JPA anyway. This Java class would map to the following table (depending on your database, here given in on...
@Entity class Note { @Id Integer id; @Basic String note; @Transient String parsedNote; String readParsedNote() { if (parsedNote == null) { /* initialize from note */ } return parsedNote; } } If your class needs fields that should ...
Time and date come in a number of different types in Java: The now historic Date and Calendar, and the more recent LocalDate and LocalDateTime. And Timestamp, Instant, ZonedLocalDateTime and the Joda-time types. On the database side, we have time, date and timestamp (both time and date), possibly wi...
Here we have a class and we want the identity field (userUid) to have its value generated via a SEQUENCE in the database. This SEQUENCE is assumed to be called USER_UID_SEQ, and can be created by a DBA, or can be created by the JPA provider. @Entity @Table(name="USER") public class User...

Page 1 of 1