Package dev.morphia.dao
Interface DAO<T,K>
-
- Type Parameters:
T- The Java type serviced by this DAOK- The Key type used by the entity
@Deprecated public interface DAO<T,K>Deprecated.This interface poorly tracks Datastore's API. Use Datastore directly or wrap in an application specific DAODefines a basic interface for use in applications
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description longcount()Deprecated.longcount(Query<T> query)Deprecated.longcount(java.lang.String key, java.lang.Object value)Deprecated.Query<T>createQuery()Deprecated.Starts a query for this DAO entities typeUpdateOperations<T>createUpdateOperations()Deprecated.Starts a update-operations def for this DAO entities typecom.mongodb.WriteResultdelete(T entity)Deprecated.Deletes an entitycom.mongodb.WriteResultdelete(T entity, com.mongodb.WriteConcern wc)Deprecated.Deletes an entitycom.mongodb.WriteResultdeleteById(K id)Deprecated.Delete the entity by id valuecom.mongodb.WriteResultdeleteByQuery(Query<T> query)Deprecated.Delete the entity matching a queryvoidensureIndexes()Deprecated.ensures indexed for this DAObooleanexists(Query<T> query)Deprecated.checks for entities which match the criteriabooleanexists(java.lang.String key, java.lang.Object value)Deprecated.checks for entities which match criteria {key:value}Query<T>find()Deprecated.Finds all the documents in the collection mapped by the entity classQuery<T>find(Query<T> query)Deprecated.Finds entities matching a queryjava.util.List<K>findIds()Deprecated.Finds the entities Tsjava.util.List<K>findIds(Query<T> query)Deprecated.Finds the entities Ts by the criteria {key:value}java.util.List<K>findIds(java.lang.String key, java.lang.Object value)Deprecated.Finds the entities Keyby the criteria {key:value} TfindOne(Query<T> query)Deprecated.Finds the first entity matching the query.TfindOne(java.lang.String key, java.lang.Object value)Deprecated.Finds the first entity matching the query.Key<T>findOneId()Deprecated.Finds the first entity's IDKey<T>findOneId(Query<T> query)Deprecated.Finds the first entity's IDKey<T>findOneId(java.lang.String key, java.lang.Object value)Deprecated.Finds the first entity's ID matching a queryTget(K id)Deprecated.Loads the entity by id valuecom.mongodb.DBCollectiongetCollection()Deprecated.the return type for this method will change in 2.0DatastoregetDatastore()Deprecated.java.lang.Class<T>getEntityClass()Deprecated.The type of entities for this DAOKey<T>save(T entity)Deprecated.Saves the entity; either inserting or overriding the existing documentKey<T>save(T entity, com.mongodb.WriteConcern wc)Deprecated.Saves the entity; either inserting or overriding the existing documentUpdateResultsupdate(Query<T> query, UpdateOperations<T> ops)Deprecated.Updates all entities matched by the constraints with the modifiers supplied.UpdateResultsupdateFirst(Query<T> query, UpdateOperations<T> ops)Deprecated.Updates the first entity matched by the constraints with the modifiers supplied.
-
-
-
Method Detail
-
count
long count()
Deprecated.- Returns:
- the total count
-
count
long count(java.lang.String key, java.lang.Object value)Deprecated.- Parameters:
key- The key to search withvalue- the value to look for- Returns:
- the count which match criteria {key:value}
-
count
long count(Query<T> query)
Deprecated.- Parameters:
query- the query to use when counting- Returns:
- the count which match the criteria
-
createQuery
Query<T> createQuery()
Deprecated.Starts a query for this DAO entities type- Returns:
- the query
-
createUpdateOperations
UpdateOperations<T> createUpdateOperations()
Deprecated.Starts a update-operations def for this DAO entities type- Returns:
- a new empty UpdateOperations instance
-
delete
com.mongodb.WriteResult delete(T entity)
Deprecated.Deletes an entity- Parameters:
entity- the entity to delete- Returns:
- the results of the deletion
- See Also:
WriteResult
-
delete
com.mongodb.WriteResult delete(T entity, com.mongodb.WriteConcern wc)
Deprecated.Deletes an entity- Parameters:
entity- the entity to deletewc- the WriteConcern to use when deleting- Returns:
- the results of the deletion
- See Also:
WriteConcern,WriteResult
-
deleteById
com.mongodb.WriteResult deleteById(K id)
Deprecated.Delete the entity by id value- Parameters:
id- the ID of the document to delete- Returns:
- the results of the deletion
- See Also:
WriteResult
-
deleteByQuery
com.mongodb.WriteResult deleteByQuery(Query<T> query)
Deprecated.Delete the entity matching a query- Parameters:
query- the query to use when finding the documents to delete- Returns:
- the results of the deletion
- See Also:
WriteResult
-
ensureIndexes
void ensureIndexes()
Deprecated.ensures indexed for this DAO
-
exists
boolean exists(java.lang.String key, java.lang.Object value)Deprecated.checks for entities which match criteria {key:value}- Parameters:
key- the key to queryvalue- the value to search for- Returns:
- true if a document is found with a key matching the value
-
exists
boolean exists(Query<T> query)
Deprecated.checks for entities which match the criteria- Parameters:
query- the query to use when finding the documents- Returns:
- true if a document is found matching the query
-
find
Query<T> find()
Deprecated.Finds all the documents in the collection mapped by the entity class- Returns:
- the entities
- See Also:
getEntityClass()
-
find
Query<T> find(Query<T> query)
Deprecated.Finds entities matching a query- Parameters:
query- the query to use when finding the documents- Returns:
- the entities which match the criteria
-
findIds
java.util.List<K> findIds()
Deprecated.Finds the entities Ts- Returns:
- the list of IDs
-
findIds
java.util.List<K> findIds(java.lang.String key, java.lang.Object value)
Deprecated.Finds the entities Keyby the criteria {key:value} - Parameters:
key- the key to queryvalue- the value to search for- Returns:
- the list of IDs for documents matching the query
-
findIds
java.util.List<K> findIds(Query<T> query)
Deprecated.Finds the entities Ts by the criteria {key:value}- Parameters:
query- the query to use when finding the documents- Returns:
- the list of IDs for documents matching the query
-
findOne
T findOne(java.lang.String key, java.lang.Object value)
Deprecated.Finds the first entity matching the query.- Parameters:
key- the key to queryvalue- the value to search for- Returns:
- the entity which match criteria {key:value}
-
findOne
T findOne(Query<T> query)
Deprecated.Finds the first entity matching the query.- Parameters:
query- the query to use when finding the documents- Returns:
- the entity which match the criteria
-
findOneId
Key<T> findOneId()
Deprecated.Finds the first entity's ID- Returns:
- the Key of the first entity
-
findOneId
Key<T> findOneId(java.lang.String key, java.lang.Object value)
Deprecated.Finds the first entity's ID matching a query- Parameters:
key- the key to queryvalue- the value to search for- Returns:
- the Key of the first entity
-
findOneId
Key<T> findOneId(Query<T> query)
Deprecated.Finds the first entity's ID- Parameters:
query- the query to use when finding the documents- Returns:
- the Key of the first entity
-
get
T get(K id)
Deprecated.Loads the entity by id value- Parameters:
id- the ID to search for- Returns:
- the entity with the given ID or null if no document in the database has the given ID
-
getCollection
@Deprecated com.mongodb.DBCollection getCollection()
Deprecated.the return type for this method will change in 2.0- Returns:
- the collection mapped by the entity class
- See Also:
getEntityClass()
-
getDatastore
Datastore getDatastore()
Deprecated.- Returns:
- the underlying datastore
-
getEntityClass
java.lang.Class<T> getEntityClass()
Deprecated.The type of entities for this DAO- Returns:
- the entity class
-
save
Key<T> save(T entity)
Deprecated.Saves the entity; either inserting or overriding the existing document- Parameters:
entity- the entity to save- Returns:
- the key of the entity
-
save
Key<T> save(T entity, com.mongodb.WriteConcern wc)
Deprecated.Saves the entity; either inserting or overriding the existing document- Parameters:
entity- the entity to savewc- the WriteConcern to use when saving- Returns:
- the key of the entity
- See Also:
WriteConcern
-
update
UpdateResults update(Query<T> query, UpdateOperations<T> ops)
Deprecated.Updates all entities matched by the constraints with the modifiers supplied.- Parameters:
query- the query used to match the documents to updateops- the update operations to perform- Returns:
- the results of the updates
-
updateFirst
UpdateResults updateFirst(Query<T> query, UpdateOperations<T> ops)
Deprecated.Updates the first entity matched by the constraints with the modifiers supplied.- Parameters:
query- the query used to match the document to updateops- the update operations to perform- Returns:
- the results of the update
-
-