Object relational mapping
This presentation is the property of its rightful owner.
Sponsored Links
1 / 13

Object Relational Mapping PowerPoint PPT Presentation


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

Object Relational Mapping. Kiki Ahmadi linuxgembel.wordpress.com YM : gembel_linux [email protected] ORM ?. Teknik memetakan database menggunakan object Jembatan antara OOP dengan RDBMS Poupuler di Java. Kenapa ORM ?. Menghindarkan programmer dari kode SQL

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

Object Relational Mapping

Kiki Ahmadi

linuxgembel.wordpress.com

YM : gembel_linux

[email protected]


Object relational mapping

ORM ?

  • Teknik memetakan database menggunakan object

  • Jembatan antara OOP dengan RDBMS

  • Poupuler di Java


Kenapa orm

Kenapa ORM ?

  • Menghindarkan programmer dari kode SQL

  • Memisahkan kode SQL dari logika aplikasi

  • Mempermudah Maintenance

  • Menghindari ketergantungan aplikasi terhadap vendor database


Non orm

Non ORM


Object relational mapping

ORM

  • Tidak ada kode SQL pada Source Code

  • Tidak ada ketergantungan terhadap DB server

  • Baris kode lebih sedikit


Orm pada java

ORM pada JAVA

EclipseLink

HIBERNATE

Apache IBATIS

Oracle Toplink Essentials

Open JPA


Cara kerja orm

Database dipetakan menggunakan POJO

Proses CRUD dilakukan menggunakan DAO

Cara Kerja ORM


Object relational mapping

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;

}


Object relational mapping

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

Hibernate

  • Framework ORM paling populer di java

  • Didevelop oleh JBoss

  • Memetakan POJO dengan Tabel


Hibernate mapping

Hibernate Mapping


Apache ibatis

Apache Ibatis

  • Framework ORM

  • Mapping POJO ke QUERY

  • Sehingga satu POJO bisa memetakan lebih dari satu tabel


Ibatis mapping

Ibatis Mapping


  • Login