Skip to content

Instantly share code, notes, and snippets.

@solars
Created March 24, 2011 15:29
Show Gist options
  • Save solars/885246 to your computer and use it in GitHub Desktop.
Save solars/885246 to your computer and use it in GitHub Desktop.
@Model
class User {
@Id
private Long id;
@Attribute
private String name;
@Attribute
@Indexed
private int age;
@Reference
@Indexed
private Country country;
@CollectionList(of = Comment.class)
@Indexed
private List<Comment> comments;
@CollectionSet(of = Item.class)
@Indexed
private Set<Item> purchases;
@CollectionMap(key = Integer.class, value = Item.class)
@Indexed
private Map<Integer, Item> favoritePurchases;
@CollectionSortedSet(of = Item.class, by = "price")
@Indexed
private Set<Item> orderedPurchases;
@Array(of = Item.class, length = 3)
@Indexed
private Item[] threeLatestPurchases;
}
@Model
class Comment {
@Id
private Long id;
@Attribute
private String text;
}
@Model
class Item {
@Id
private Long id;
@Attribute
private String name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment