简体   繁体   中英

Difference between createQuery and find in Morphia?

The documentation says:

/** Returns a new query bound to the collection (a specific DBCollection) **/
<T> Query<T> createQuery(Class<T> collection);

/** Find all instances by type **/
<T> Query<T> find(Class<T> clazz)

Both return a Query<T> object. The results are equal. What is the difference?

They are identical.

Looking at DataSourceImpl.java, it is just a wrapper for createQuery.

// DatastoreImpl.java

@Override
public <T> Query<T> find(final Class<T> clazz) {
    return createQuery(clazz);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM