db4o |

# ObjectContainer.get Method

Query-By-Example interface to retrieve objects.

ObjectSet get(
object template
);

#### Parameters

template
  object to be used as an example to find all matching objects.

#### Return Value

ObjectSet containing all found objects.

#### Remarks

Query-By-Example interface to retrieve objects.

    get()

creates an ObjectSet containing all objects in the

    ObjectContainer

that match the passed template object.
Calling

    get(NULL)

returns all objects stored in the

    ObjectContainer

.
Query Evaluation
All non-null members of the template object are compared against all stored objects of the same class. Primitive type members are ignored if they are 0 or false respectively.
Arrays and all supported

    Collection

classes are evaluated for containment. Differences in

    length/size()

are ignored.
Consult the documentation of the Configuration package to configure class-specific behaviour.
Returned Objects
The objects returned in the ObjectSet are instantiated and activated to the preconfigured depth of 5. The activationDepth may be configured globally or individually for classes .
db4o keeps track of all instantiatied objects. Queries will return references to these objects instead of instantiating them a second time.
Objects newly activated by

    get()

can respond to the callback method objectOnActivate .

#### See Also

ObjectContainer Interface | com.db4o Namespace | activationDepth | Using callbacks