play.db.jpa.Model Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of framework Show documentation
Show all versions of framework Show documentation
RePlay is a fork of the Play1 framework, created by Codeborne.
package play.db.jpa;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;
import javax.annotation.Nullable;
/**
* Base class for JPA model objects.
* Automatically provides an @Id Long id field.
*/
@MappedSuperclass
public class Model extends GenericModel {
@Id
@GeneratedValue
protected Long id;
public @Nullable Long getId() {
return id;
}
public void setId(@Nullable Long id) {
this.id = id;
}
@Override
public Object _key() {
return getId();
}
}