Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Realm Java

2,678 views

Published on

a talk @ GDG Incheon Jan 23, 2016

Published in: Technology

Realm Java

  1. 1. Realm Java Leonardo YongUk Kim lk@realm.io
  2. 2. Yet another database?
  3. 3. No more SQL
  4. 4. String query = "SELECT " + Owner.NAME + ", " + Dog.NAME + ", " + City.NAME + " FROM " + Owner.TABLE_NAME + " INNER JOIN " + Dog.TABLE_NAME + " ON " + Owner.DOG_ID + " = " + Dog.ID + " INNER JOIN " + City.TABLE_NAME + " ON " + Owner.CITY_ID + " = " + City.ID + " WHERE " + Owner.NAME = "'" + escape(queryName) + "'";
  5. 5. Use cases
  6. 6. Fastest
  7. 7. Why is it so fast?
  8. 8. Traditional data structure Column-based data structure • Padding bits are not needed anymore. • Queries for columns help the cache hit rate. • Boolean type fields are put into integers field. • Other fields are packaged as 1, 2, 4, 8, 16, 32, 64bits. • More space efficient than SQLite (~50%)
  9. 9. How to use?
  10. 10. Extend RealmObject class
  11. 11. Create a standalone object, and then copy it to Realm
  12. 12. Instantiate through the Realm directly
  13. 13. Use realm.executeTransaction() method
  14. 14. Asynchronous transactions
  15. 15. Logical operators
  16. 16. Sorting
  17. 17. Chaining
  18. 18. Aggregation
  19. 19. Iteration
  20. 20. Deletion
  21. 21. Async queries
  22. 22. Async queries (cont.)
  23. 23. Relationships (Many-To-One)
  24. 24. Relationships (Many-To-One)
  25. 25. Link queries RealmResults<Contact> contacts = realm.where(Contact.class).equalTo("emails.active", true).findAll();
  26. 26. Migrations
  27. 27. Migrations (cont.)
  28. 28. Encryption
  29. 29. Adapter
  30. 30. Q&A kr@realm.io

×