Package ubic.gemma.persistence.persister
Interface Persister
-
- All Known Subinterfaces:
PersisterHelper
- All Known Implementing Classes:
AbstractPersister
,ArrayDesignPersister
,CommonPersister
,ExpressionPersister
,GenomePersister
,PersisterHelperImpl
,RelationshipPersister
public interface Persister
Interface defining the ability to create domain objects in bulk or singly. Classes that implement this interface should expect:- To be passed an object graph that is valid - that is, all non-nullable properties and associations are filled in.
- The objects passed might include objects that are already persistent in the system.
- Author:
- keshav, Paul Pavlidis
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
persist(Object obj)
Persist a single object.List<?>
persist(Collection<?> col)
Persist all the objects in a collection.Object
persistOrUpdate(Object obj)
Persist or update a single object.
-
-
-
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.
-
-