org.springframework.datastore.engine
Interface Persister

All Known Implementing Classes:
AbstractKeyValueEntityPesister, EntityPersister, LockableEntityPersister, RedisEntityPersister

public interface Persister

A Persister is responsible for persisting and retrieving an object.

Since:
1.0

Method Summary
 Query createQuery()
          Creates a query for the entity
 void delete(Iterable objects)
          Deletes one or many objects
 void delete(Object obj)
          Deletes a single object
 Class getType()
          The type this persister persists
 List<Serializable> persist(Iterable objs)
          Persists a number of objects at the same time and returns their keys in the order specified by the objs parameter
 Serializable persist(Object obj)
          Persist an object using the given mapping context
 Object proxy(Serializable key)
          Creates a proxy for the given key
 Serializable refresh(Object o)
          Refreshes the given objects state
 Object retrieve(Serializable key)
          Retrieves an object for the given context and Key
 List<Object> retrieveAll(Iterable<Serializable> keys)
          Batch retrieve several objects in one go
 List<Object> retrieveAll(Serializable[] keys)
          Batch retrieve several objects in one go
 

Method Detail

getType

Class getType()
The type this persister persists

Returns:
The class this persisters persists

persist

Serializable persist(Object obj)
Persist an object using the given mapping context

Parameters:
obj - The object
Returns:
A generated Key

persist

List<Serializable> persist(Iterable objs)
Persists a number of objects at the same time and returns their keys in the order specified by the objs parameter

Parameters:
objs - The objects
Returns:
A list of keys

retrieve

Object retrieve(Serializable key)
Retrieves an object for the given context and Key

Parameters:
key - The key
Returns:
The object in question

proxy

Object proxy(Serializable key)
Creates a proxy for the given key

Parameters:
key - The key
Returns:
The proxy

delete

void delete(Iterable objects)
Deletes one or many objects

Parameters:
objects - The objects to delete. Must all be of the same type or an exception will be thrown.

retrieveAll

List<Object> retrieveAll(Iterable<Serializable> keys)
Batch retrieve several objects in one go

Parameters:
keys - The keys
Returns:
The objects in a list in the same order as the specified keys

delete

void delete(Object obj)
Deletes a single object

Parameters:
obj - The object

createQuery

Query createQuery()
Creates a query for the entity

Returns:
The Query object

retrieveAll

List<Object> retrieveAll(Serializable[] keys)
Batch retrieve several objects in one go

Parameters:
keys - The keys
Returns:
The objects in a list in the same order as the specified keys

refresh

Serializable refresh(Object o)
Refreshes the given objects state

Parameters:
o - The object to refresh
Returns:
The objects id