Shay Banon home

 

Lazy Reference Collection Mapping

Upcoming Compass 2.1 M3 now has a new feature allowing for lazy loaded reference mapping in Compass when using it on top of collections. Reference mapping in Compass simply stores the relationship between one object and another (the ids), and many times there is no need to load all the references in advance while unmarshalling an object. Now, reference mappings on top of collections can be lazily loaded. Here is an example:


@Searchable
public class Customer {

@SearchableId private int id; @SearchableReference(lazy = Lazy.TRUE) private List orders;

}

@Searchable
public class Order {

@SearchableId private int id;

}

© 2003-2010 Shay Banon
Fork me on GitHub