1 / 13

Object Relational Mapping

Object Relational Mapping. Kiki Ahmadi linuxgembel.wordpress.com YM : gembel_linux jug-bonek@yahoogroups.com. ORM ?. Teknik memetakan database menggunakan object Jembatan antara OOP dengan RDBMS Poupuler di Java. Kenapa ORM ?. Menghindarkan programmer dari kode SQL

locke
Download Presentation

Object Relational Mapping

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. Object Relational Mapping Kiki Ahmadi linuxgembel.wordpress.com YM : gembel_linux jug-bonek@yahoogroups.com

  2. ORM ? • Teknik memetakan database menggunakan object • Jembatan antara OOP dengan RDBMS • Poupuler di Java

  3. Kenapa ORM ? • Menghindarkan programmer dari kode SQL • Memisahkan kode SQL dari logika aplikasi • Mempermudah Maintenance • Menghindari ketergantungan aplikasi terhadap vendor database

  4. Non ORM

  5. ORM • Tidak ada kode SQL pada Source Code • Tidak ada ketergantungan terhadap DB server • Baris kode lebih sedikit

  6. ORM pada JAVA EclipseLink HIBERNATE Apache IBATIS Oracle Toplink Essentials Open JPA

  7. Database dipetakan menggunakan POJO Proses CRUD dilakukan menggunakan DAO Cara Kerja ORM

  8. POJO ? • Plain Old Java Object public class Mahasiswa { private int NRP; private String Nama; private String password; public String getNama() { return Nama; } public int getNRP() { return NRP; } public String getPassword() { return password; } public void setNama(String nama) { Nama = nama; } public void setNRP(int nrp) { NRP = nrp; } public void setPassword(String password) { this.password = password; }

  9. DAO ? • Data Access Object public class MahasiswaDAO { public void tambahMhs (){ Mahasiswa ophex = new Mahasiswa(); ophex.setNRP(1); ophex.setNama("ophex"); ophex.setPassword("mbuh"); HibernateUtil.getSessionFactory() .getCurrentSession().save(ophex); } }

  10. Hibernate • Framework ORM paling populer di java • Didevelop oleh JBoss • Memetakan POJO dengan Tabel

  11. Hibernate Mapping

  12. Apache Ibatis • Framework ORM • Mapping POJO ke QUERY • Sehingga satu POJO bisa memetakan lebih dari satu tabel

  13. Ibatis Mapping

More Related