Package dev.morphia.dao
Class BasicDAO<T,K>
- java.lang.Object
-
- dev.morphia.dao.BasicDAO<T,K>
-
- Type Parameters:
T- the type of the entityK- the type of the key
- All Implemented Interfaces:
DAO<T,K>
- Direct Known Subclasses:
DAO
@Deprecated public class BasicDAO<T,K> extends java.lang.Object implements DAO<T,K>
Deprecated.This interface poorly tracks Datastore's API. Use Datastore directly or wrap in an application specific DAO- Author:
- Olafur Gauti Gudmundsson, Scott Hernandez
-
-
Field Summary
Fields Modifier and Type Field Description protected DatastoreImpldsDeprecated.usegetDatastore()protected java.lang.Class<T>entityClazzDeprecated.usegetEntityClass()
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasicDAO(com.mongodb.MongoClient mongoClient, Morphia morphia, java.lang.String dbName)Deprecated.Only calls this from your derived class when you explicitly declare the generic types with concrete classesprotectedBasicDAO(Datastore ds)Deprecated.BasicDAO(java.lang.Class<T> entityClass, com.mongodb.MongoClient mongoClient, Morphia morphia, java.lang.String dbName)Deprecated.Create a new BasicDAOBasicDAO(java.lang.Class<T> entityClass, Datastore ds)Deprecated.Create a new BasicDAO
-
Method Summary
All Methods Instance Methods Concrete 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.DatastoregetDatastore()Deprecated.DatastoreImplgetDs()Deprecated.usegetDatastore()java.lang.Class<T>getEntityClass()Deprecated.The type of entities for this DAOjava.lang.Class<T>getEntityClazz()Deprecated.usegetEntityClass()insteadprotected voidinitDS(com.mongodb.MongoClient mongoClient, Morphia mor, java.lang.String db)Deprecated.protected voidinitType(java.lang.Class<T> type)Deprecated.protected java.util.List<?>keysToIds(java.util.List<Key<T>> keys)Deprecated.Converts from a Listto their id values Key<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.
-
-
-
Field Detail
-
entityClazz
@Deprecated protected java.lang.Class<T> entityClazz
Deprecated.usegetEntityClass()
-
ds
@Deprecated protected DatastoreImpl ds
Deprecated.usegetDatastore()
-
-
Constructor Detail
-
BasicDAO
public BasicDAO(java.lang.Class<T> entityClass, com.mongodb.MongoClient mongoClient, Morphia morphia, java.lang.String dbName)
Deprecated.Create a new BasicDAO- Parameters:
entityClass- the class of the POJO you want to persist using this DAOmongoClient- the representations of the connection to a MongoDB instancemorphia- a Morphia instancedbName- the name of the database
-
BasicDAO
public BasicDAO(java.lang.Class<T> entityClass, Datastore ds)
Deprecated.Create a new BasicDAO- Parameters:
entityClass- the class of the POJO you want to persist using this DAOds- the Datastore which gives access to the MongoDB instance for this DAO
-
BasicDAO
protected BasicDAO(com.mongodb.MongoClient mongoClient, Morphia morphia, java.lang.String dbName)Deprecated.Only calls this from your derived class when you explicitly declare the generic types with concrete classesclass MyDao extends DAO<MyEntity, String>- Parameters:
mongoClient- the representations of the connection to a MongoDB instancemorphia- a Morphia instancedbName- the name of the database
-
BasicDAO
protected BasicDAO(Datastore ds)
Deprecated.
-
-
Method Detail
-
count
public long count()
Deprecated.
-
count
public long count(java.lang.String key, java.lang.Object value)Deprecated.
-
createQuery
public Query<T> createQuery()
Deprecated.Description copied from interface:DAOStarts a query for this DAO entities type- Specified by:
createQueryin interfaceDAO<T,K>- Returns:
- the query
-
createUpdateOperations
public UpdateOperations<T> createUpdateOperations()
Deprecated.Description copied from interface:DAOStarts a update-operations def for this DAO entities type- Specified by:
createUpdateOperationsin interfaceDAO<T,K>- Returns:
- a new empty UpdateOperations instance
-
delete
public com.mongodb.WriteResult delete(T entity)
Deprecated.Description copied from interface:DAODeletes an entity
-
delete
public com.mongodb.WriteResult delete(T entity, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:DAODeletes an entity
-
deleteById
public com.mongodb.WriteResult deleteById(K id)
Deprecated.Description copied from interface:DAODelete the entity by id value- Specified by:
deleteByIdin interfaceDAO<T,K>- Parameters:
id- the ID of the document to delete- Returns:
- the results of the deletion
- See Also:
WriteResult
-
deleteByQuery
public com.mongodb.WriteResult deleteByQuery(Query<T> query)
Deprecated.Description copied from interface:DAODelete the entity matching a query- Specified by:
deleteByQueryin interfaceDAO<T,K>- Parameters:
query- the query to use when finding the documents to delete- Returns:
- the results of the deletion
- See Also:
WriteResult
-
ensureIndexes
public void ensureIndexes()
Deprecated.Description copied from interface:DAOensures indexed for this DAO- Specified by:
ensureIndexesin interfaceDAO<T,K>
-
exists
public boolean exists(java.lang.String key, java.lang.Object value)Deprecated.Description copied from interface:DAOchecks for entities which match criteria {key:value}
-
exists
public boolean exists(Query<T> query)
Deprecated.Description copied from interface:DAOchecks for entities which match the criteria
-
find
public Query<T> find()
Deprecated.Description copied from interface:DAOFinds all the documents in the collection mapped by the entity class- Specified by:
findin interfaceDAO<T,K>- Returns:
- the entities
- See Also:
DAO.getEntityClass()
-
find
public Query<T> find(Query<T> query)
Deprecated.Description copied from interface:DAOFinds entities matching a query
-
findIds
public java.util.List<K> findIds()
Deprecated.Description copied from interface:DAOFinds the entities Ts
-
findIds
public java.util.List<K> findIds(java.lang.String key, java.lang.Object value)
Deprecated.Description copied from interface:DAOFinds the entities Keyby the criteria {key:value}
-
findIds
public java.util.List<K> findIds(Query<T> query)
Deprecated.Description copied from interface:DAOFinds the entities Ts by the criteria {key:value}
-
findOne
public T findOne(java.lang.String key, java.lang.Object value)
Deprecated.Description copied from interface:DAOFinds the first entity matching the query.
-
findOne
public T findOne(Query<T> query)
Deprecated.Description copied from interface:DAOFinds the first entity matching the query.
-
findOneId
public Key<T> findOneId()
Deprecated.Description copied from interface:DAOFinds the first entity's ID
-
findOneId
public Key<T> findOneId(java.lang.String key, java.lang.Object value)
Deprecated.Description copied from interface:DAOFinds the first entity's ID matching a query
-
findOneId
public Key<T> findOneId(Query<T> query)
Deprecated.Description copied from interface:DAOFinds the first entity's ID
-
get
public T get(K id)
Deprecated.Description copied from interface:DAOLoads the entity by id value
-
getCollection
public com.mongodb.DBCollection getCollection()
Deprecated.- Specified by:
getCollectionin interfaceDAO<T,K>- Returns:
- the collection mapped by the entity class
- See Also:
DAO.getEntityClass()
-
getDatastore
public Datastore getDatastore()
Deprecated.- Specified by:
getDatastorein interfaceDAO<T,K>- Returns:
- the underlying datastore
-
getEntityClass
public java.lang.Class<T> getEntityClass()
Deprecated.Description copied from interface:DAOThe type of entities for this DAO- Specified by:
getEntityClassin interfaceDAO<T,K>- Returns:
- the entity class
-
save
public Key<T> save(T entity)
Deprecated.Description copied from interface:DAOSaves the entity; either inserting or overriding the existing document
-
save
public Key<T> save(T entity, com.mongodb.WriteConcern wc)
Deprecated.Description copied from interface:DAOSaves the entity; either inserting or overriding the existing document
-
update
public UpdateResults update(Query<T> query, UpdateOperations<T> ops)
Deprecated.Description copied from interface:DAOUpdates all entities matched by the constraints with the modifiers supplied.
-
updateFirst
public UpdateResults updateFirst(Query<T> query, UpdateOperations<T> ops)
Deprecated.Description copied from interface:DAOUpdates the first entity matched by the constraints with the modifiers supplied.- Specified by:
updateFirstin interfaceDAO<T,K>- Parameters:
query- the query used to match the document to updateops- the update operations to perform- Returns:
- the results of the update
-
getDs
@Deprecated public DatastoreImpl getDs()
Deprecated.usegetDatastore()- Returns:
- the Datastore used by this DAO
-
getEntityClazz
@Deprecated public java.lang.Class<T> getEntityClazz()
Deprecated.usegetEntityClass()instead- Returns:
- the entity class
-
initDS
protected void initDS(com.mongodb.MongoClient mongoClient, Morphia mor, java.lang.String db)Deprecated.
-
initType
protected void initType(java.lang.Class<T> type)
Deprecated.
-
-