Spring
Note
- Path
- pkg21spring/src/main/java/com/javamastery/notes/Note.java
- Package
- pkg21spring
- Study order
- 0
- Run
- Read this file. It has no standalone main method.
- Dependencies
- jakarta.persistence.Entity, jakarta.persistence.GeneratedValue, jakarta.persistence.Id
There is no in-browser runner. This is the file from the curriculum, unchanged.
1package com.javamastery.notes;2 3import jakarta.persistence.Entity;4import jakarta.persistence.GeneratedValue;5import jakarta.persistence.Id;6 7@Entity8public class Note {9 @Id10 @GeneratedValue11 private Long id;12 private String title;13 private String body;14 15 public Note() {}16 17 public Note(String title, String body) {18 this.title = title;19 this.body = body;20 }21 22 public Long getId() { return id; }23 public String getTitle() { return title; }24 public void setTitle(String title) { this.title = title; }25 public String getBody() { return body; }26 public void setBody(String body) { this.body = body; }27}