Skip to content

Instantly share code, notes, and snippets.

@ljnelson
Created February 19, 2020 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljnelson/42d467d4e763be4e48396f0be91e1ce8 to your computer and use it in GitHub Desktop.
Save ljnelson/42d467d4e763be4e48396f0be91e1ce8 to your computer and use it in GitHub Desktop.
package io.helidon.example.jpa;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Access(value = AccessType.FIELD)
@Entity(name = "Greeting")
@Table(name = "GREETING")
public class Greeting implements Serializable {
@Column(
insertable = true,
name = "SALUTATION",
nullable = false,
updatable = false
)
@Id
private String salutation;
@Basic(optional = false)
@Column(
insertable = true,
name = "RESPONSE",
nullable = false,
updatable = true
)
private String response;
@Deprecated
protected Greeting() {
super();
}
public Greeting(String salutation, String response) {
super();
this.salutation = Objects.requireNonNull(salutation);
this.setResponse(response);
}
public String getSalutation() {
return this.salutation;
}
public String getResponse() {
return this.response;
}
public void setResponse(String response) {
this.response = Objects.requireNonNull(response);
}
@Override
public String toString() {
return this.getSalutation() + " " + this.getResponse();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment