Interface Persister

    • Method Detail

      • persist

        @Secured("GROUP_USER")
        @CheckReturnValue
        Object persist​(Object obj)
        Persist a single object. Non-nullable dependencies are checked and persisted first, if the reference is detached, or converted into a reference to a persistent object identified by the objects business key. If a matching object already exists, it will not be changed.
        Parameters:
        obj - the object
        Returns:
        the persistent version of the object.
      • persist

        @Secured("GROUP_USER")
        @CheckReturnValue
        List<?> persist​(Collection<?> col)
        Persist all the objects in a collection. Non-nullable dependencies are checked and persisted first, if the reference is detached, or converted into a reference to a persistent object identified by the objects business key. Matching instances are not changed.
        Parameters:
        col - the collection of objects
        Returns:
        The persistent versions of the objects.
      • persistOrUpdate

        @Secured("GROUP_USER")
        @CheckReturnValue
        Object persistOrUpdate​(Object obj)
        Persist or update a single object. If the object already exists in the system, it will be replaced with the supplied instance. This means that any existing data may be lost. Otherwise a new persistent instance will be created from the supplied instance. Non-nullable dependencies will be replaced with existing persistent ones or created anew: Associated objects will not be updated if they already exist. Therefore this method has limited usefulness: when the provided object has new data but the associated objects are either new or already existing. If you want to update associated objects you must update them explicitly (perhaps with a call to persistOrUpdate on them).
        Parameters:
        obj - the object
        Returns:
        the persistent version of the object.