1 / 17

Tallinna Tehnikaülikool Informaatikainstituut Javal baseeruv objektide püsivuse kiht Jakamar

Tallinna Tehnikaülikool Informaatikainstituut Javal baseeruv objektide püsivuse kiht Jakamar Bakalaureusetöö Üliõpilane: Erki Suurjaak Matrikli nr: 970772 Juhendaja: Tarmo Veskioja. Defence Overview. What is object persistence What solution did I propose What is Jakamar

howard
Download Presentation

Tallinna Tehnikaülikool Informaatikainstituut Javal baseeruv objektide püsivuse kiht Jakamar

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tallinna Tehnikaülikool Informaatikainstituut Javal baseeruv objektide püsivuse kiht Jakamar Bakalaureusetöö Üliõpilane: Erki Suurjaak Matrikli nr: 970772 Juhendaja: Tarmo Veskioja

  2. Defence Overview • What is object persistence • What solution did I propose • What is Jakamar • Benefits and tradeoffs

  3. Objects Objects Objects What is object persistence • objects existing beyond application’s lifetime Application Data Store

  4. Concerns using OOP and RDBMS • handling changes in the data structure • possible to reuse persistence logic

  5. What solution did I propose Persistence Broker design pattern • enables full separation of business and persistence logic • easily customizable for different applications • offers useful functionality, like object caching

  6. User Interface Classes Business classes Persistence Broker Cache Database User Interface Classes Business classes Database Architecture Simple architecture Using a Persistence Broker

  7. What is Jakamar • a reusable component • provides automated persistence

  8. architecture program flow functionality error handling security concurrent use logging configuration Jakamar in the thesis

  9. Benefits • Easier maintenance • Less program code to write: access to persistence via simple operations like • store(object) • delete(object) • retrieve(query criteria)

  10. Benefits (2) Accessing the database directly Using Jakamar Connection connection = DriverManager.getConnection("jdbc:odbc:emt"); Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM PERSON WHERE location = 'Jõhvi'"); Collection results = newArrayList(); while (rs.next()) { Person person = newPerson(); person.id = rs.getInt("id"); person.firstName = rs.getString("firstName"); person.lastName = rs.getString("lastName"); person.location = rs.getString("location"); results.add(person); Statement stmtSub = connection.createStatement(); ResultSet rsSub = stmtSub.executeQuery( "SELECT * FROM PHONE WHERE personId = " + person.id); while (rsSub.next()) { Phone phone = new Phone(); phone.id = rsSub.getInt("id"); phone.personId = rsSub.getInt("personId"); phone.phone = rsSub.getString("phone"); person.phones.add(phone); } stmtSub.close(); } stmt.close(); connection.close(); PersistenceBroker broker = PersistenceBrokerFactory.create("conf.xml"); Person param = newPerson(); param.location = "Jõhvi"; Query query = broker.createQuery(param, new String[]{"location"}, null); Collection results = broker.retrieveCollection(query);

  11. Tradeoffs • decrease in functionality • with embedded SQL,extremely complex queries accessible as easily as simple retrieval • with Jakamar, restrictions on query complexity

  12. Benchmarks • better performance on object retrieval • worse performance on storing objects Repeated? - whether the same operation was repeated multiple times

  13. Conclusion • the Persistence Broker pattern is a good approach • Jakamar is a viable component • faster development • better modularized application structure • possibly better performance on retrieval

  14. Further development • cursors • transactions • Object Query Language • distributed use • extent classes • graphical configuration interface

  15. Persistence Broker Caches persistent objects Looking up cached instances Retrieving Storing and deleting Accesses object fields dynamically Deleting storage and deletion Persistence Mapping Delegating queries from the application to lower level Reflection Contains mappings between classes and tables Specifying the field values of objects to store or delete Returning the field values for retrieved objects Converts object field values to table column values and vice versa Specifying the criteria field values Query Mechanism Conversion Handles executing SQL statements Cache Database-specific SQL queries Application Application Applications Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Identities Persistent Objects Queries Queries Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Column Values Field Values Field Values ACTION Queries SELECT Queries SELECT Results Field Values Field Values Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Field Values Persistent Objects Persistent Objects Persistent Objects Persistent Objects Persistent Objects Database

  16. Object relations

More Related