Object relational mapping
Download
1 / 13

Object Relational Mapping - PowerPoint PPT Presentation


  • 117 Views
  • Uploaded on
  • Presentation posted in: General

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


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

  • Memisahkan kode SQL dari logika aplikasi

  • Mempermudah Maintenance

  • Menghindari ketergantungan aplikasi terhadap vendor database


Non ORM


ORM

  • Tidak ada kode SQL pada Source Code

  • Tidak ada ketergantungan terhadap DB server

  • Baris kode lebih sedikit


ORM pada JAVA

EclipseLink

HIBERNATE

Apache IBATIS

Oracle Toplink Essentials

Open JPA


Database dipetakan menggunakan POJO

Proses CRUD dilakukan menggunakan DAO

Cara Kerja ORM


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;

}


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);

}

}


Hibernate

  • Framework ORM paling populer di java

  • Didevelop oleh JBoss

  • Memetakan POJO dengan Tabel


Hibernate Mapping


Apache Ibatis

  • Framework ORM

  • Mapping POJO ke QUERY

  • Sehingga satu POJO bisa memetakan lebih dari satu tabel


Ibatis Mapping


ad
  • Login