Package play.db.jpa

Class GenericModel

java.lang.Object
play.db.jpa.JPABase
play.db.jpa.GenericModel
All Implemented Interfaces:
Serializable, Model
Direct Known Subclasses:
Model

@MappedSuperclass public class GenericModel extends JPABase
A super class for JPA entities
See Also:
  • Constructor Details

    • GenericModel

      public GenericModel()
  • Method Details

    • create

      @Nonnull public static <T extends JPABase> T create(Http.Request request, Scope.Session session, ParamNode rootParamNode, String name, Class<?> type, Annotation[] annotations)
      Create a new model
      Type Parameters:
      T - The entity class
      Parameters:
      rootParamNode - parameters used to create the new object
      name - name of the object
      type - the class of the object
      annotations - annotations on the model
      Returns:
      The created entity
    • edit

      @Nonnull public static <T extends JPABase> T edit(Http.Request request, Scope.Session session, ParamNode rootParamNode, String name, Object o, Annotation[] annotations)
      Edit a model
      Type Parameters:
      T - class of the entity
      Parameters:
      rootParamNode - parameters used to create the new object
      name - name of the object
      o - the entity to update
      annotations - annotations on the model
      Returns:
      the entity
    • edit

      @Nonnull public <T extends GenericModel> T edit(Http.Request request, Scope.Session session, ParamNode rootParamNode, String name)
      Edit a model
      Type Parameters:
      T - class of the entity
      Parameters:
      rootParamNode - parameters used to create the new object
      name - name of the entity
      Returns:
      the entity
    • save

      @Nonnull public <T extends JPABase> T save()
    • merge

      @Nonnull public <T extends JPABase> T merge()
      Merge this object to obtain a managed entity (useful when the object comes from the Cache).
      Type Parameters:
      T - class of the entity
      Returns:
      The given entity
    • delete

      @Nonnull public <T extends JPABase> T delete()
      Delete the entity.
      Type Parameters:
      T - class of the entity
      Returns:
      The deleted entity.