Click here to view in C++ When you create an instance of a persistence-capable class, you make it persistent (instead of transient) by clustering it. Clustering a container assigns it to a database; clustering a basic object assigns it to a particular logical page within a particular container. Clustering thus determines the location of persistent objects in the logical storage hierarchy and affects their physical proximity on disk. Therefore, it's important to design your database around this concept for better performance. You can set the session's clustering strategy at anytime by calling it's setClusterStrategy function or you can set each individual object's cluster strategy by passing it through the new operator. Defining your cluster strategy: DefaultClusterStrategy newStrategy = new DefaultClusterStrategy(ClusterStrategy.newPage | ClusterStrategy.newContainer | ClusterStrategy.newDatabase);
ooSession session = ... session.setClusterStrategy(newStrategy);
Car carObj = new Car(); newStrategy.cluster(carObj);
|
|||
