All Downloads are FREE. Search and download functionalities are using the official Maven repository.

play.db.jpa.Model Maven / Gradle / Ivy

There is a newer version: 2.6.2
Show newest version
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();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy