Lazy Reference Collection Mapping

Posted by: Shay Banon on 07/26/2008

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@Searchable
public class Customer {
 
    @SearchableId
    private int id;
 
    @SearchableReference(lazy = Lazy.TRUE)
    private List<Order> orders;
}
 
@Searchable
public class Order {
 
    @SearchableId
    private int id;
}


be the first to rate this blog


About Shay Banon

Shay is the founder of the Compass open source project, a unique solution enabling search capabilities into any application model. He started working on mission critical real time C/C++ systems, later moving to Java (and never looked back). Within the Java world, Shay has worked on a propriety implementation of a distributed rule engine(RETE) server, your typical Java based web projects, and messaging based projects within the financial industry. Currently, Shay is a System Architect at GigaSpaces, GigaSpaces provides a single platform for end-to-end scalability of high performance and stateful distributed applications. GigaSpaces’ unique approach enables developers to Write their business logic Once and then seamlessly Scale out the application linearly Anywhere.