<xml> </xml>

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