2. NoSQL - A loosely defined movement - A complement to relational databases - Usually schema-less - Typically not concerned with transactions, locks or data integrity... - ...but more so with performance and scalability
7. Terrastore - Open source project founded in Sept-Oct 2009 - Written entirely in Java - Based on Terracotta - Offers per-document consistency - Distributed - Elastic - Scalable at the computational level - Extensible
8. A Terrastore document { 'name' : 'Sven Johansson', 'age' : '29', 'titles' : [ 'Developer', 'Consultant', 'Destroyer of worlds', ], 'currentlyReading : { title: 'The book of Dave' author: 'Will Self' } 'favouriteBooks' : [{ title: 'The naked and the dead', author: 'Norman Mailer' }, { title: 'On the road', author: 'Jack Kerouac' }] }
9. public class Person { private String name; private int age; private String[] titles; private Book currentlyReading; private List<Book> favouriteBooks; ... } ...and a corresponding Java Object
17. One bucket for orders Stockholm 2010-09-14, WTFPL license
18. First we need a terrastore client That localhost URL points to a terrastore server . If that server goes down, then your client is toast. Next version of the API have implemented fallbacks. Enough! I want an example, now! TerrastoreClient client = new TerrastoreClient("http://localhost:8080", new HTTPConnectionFactory()); Stockholm 2010-09-14, WTFPL license
19. Customer lindex = new Customer("Lindex"); Address dg = new Address("Drottninggatan 77"); PhoneNumber work = new PhoneNumber("1234567", "work"); PhoneNumber home = new PhoneNumber("2345678", "home"); // Set relationships lindex.setAddress(dg); lindex.addPhoneNumber(work); lindex.addPhoneNumber(home); Now lets create the POJO:s Stockholm 2010-09-14, WTFPL license
20. BucketOperation customers = client.bucket("customers"); // Create: customers.key("lindex").put(lindex); // Read: Customer l = customers.key("lindex").get(Customer.class); // Important: l != lindex // Delete: customers.key("lindex").remove(); Create, Read and Delete You can update a document with another put() Stockholm 2010-09-14, WTFPL license