Application class diagram Create database schema Create JavaBeans to be mapped

applications 294 exactly the configuration that we use in our application. Please take a look at that section to see exactly the configuration.

3.2 Application class diagram

Figure 4 - Application class diagram Below you can see the class diagram for our simple application. In the diagram you can observe the abstract class AbstractItem and the two classes that inherit it Item and EItem.

3.3 Create database schema

Now that we have configured the property file for Hibernate, we’ll have to create the database and the tables we need. In order to do that we’ll use the following scripts: Code sample 4 - Database scripts for TEST databse the databse used in our application create db test connect to test user omega using omega create table Abstract_Item Id bigint NOT NULL PRIMARY KEY, Code varchar16, Description varchar60, Subclass char1; create table Hi_Value Next_Value bigint; insert into Hi_Value Next_Value values 1; applications 295

3.4 Create JavaBeans to be mapped

In this section we’ll present the JavaBeans corresponding to the class diagram presented in section 3.2 Application Class Diagram . Code sample 5 - Create net.test.AbstractItem JavaBean package net.test; public class AbstractItem{ private String code; private String description; void setCodeString code{ setter for code; this.code=code; } String getCode{ getter for code; return code; } void setDescriptionString description{ setter for description; this.description=description; } String getDescription{ getter for description; return description; } } Code sample 6 - Create net.test.Item JavaBean package net.test; public class Item extends AbstractItem{ private String size; void setSizeString size{ setter for size; this.size=size; } String getSize{ getter for size; return size; } } Code sample 7 - Create net.test.EItem JavaBean package net.test; public class EItem extends AbstractItem{ String weight; void setWeightString weight{ setter for weight; this.weight=weight; } String getWeight{ setter for weight; applications 296 return weight; } } You must know that it is mandatory that all of your getters and setters must exist, but their visibility doesn’t matter. If you wanted to maintain immutable objects, then you could set the state of your object during the construction and all the getters and setters should be private. You would have to provide a default constructor in addition to any other constructors you created; but, the default constructor can have private visibility as well. The reason the setter and getter methods and the default constructor must exist is because Hibernate abides by the JavaBean syntax and uses these method signatures in order to persist data during OR mapping.

3.5 Create XML mapping

Dokumen yang terkait

AN ALIS IS YU RID IS PUT USAN BE B AS DAL AM P E RKAR A TIND AK P IDA NA P E NY E RTA AN M E L AK U K A N P R AK T IK K E DO K T E RA N YA NG M E N G A K IB ATK AN M ATINYA P AS IE N ( PUT USA N N O MOR: 9 0/PID.B /2011/ PN.MD O)

0 82 16

ANALISIS FAKTOR YANGMEMPENGARUHI FERTILITAS PASANGAN USIA SUBUR DI DESA SEMBORO KECAMATAN SEMBORO KABUPATEN JEMBER TAHUN 2011

2 53 20

EFEKTIVITAS PENDIDIKAN KESEHATAN TENTANG PERTOLONGAN PERTAMA PADA KECELAKAAN (P3K) TERHADAP SIKAP MASYARAKAT DALAM PENANGANAN KORBAN KECELAKAAN LALU LINTAS (Studi Di Wilayah RT 05 RW 04 Kelurahan Sukun Kota Malang)

45 393 31

FAKTOR – FAKTOR YANG MEMPENGARUHI PENYERAPAN TENAGA KERJA INDUSTRI PENGOLAHAN BESAR DAN MENENGAH PADA TINGKAT KABUPATEN / KOTA DI JAWA TIMUR TAHUN 2006 - 2011

1 35 26

A DISCOURSE ANALYSIS ON “SPA: REGAIN BALANCE OF YOUR INNER AND OUTER BEAUTY” IN THE JAKARTA POST ON 4 MARCH 2011

9 161 13

Pengaruh kualitas aktiva produktif dan non performing financing terhadap return on asset perbankan syariah (Studi Pada 3 Bank Umum Syariah Tahun 2011 – 2014)

6 101 0

Pengaruh pemahaman fiqh muamalat mahasiswa terhadap keputusan membeli produk fashion palsu (study pada mahasiswa angkatan 2011 & 2012 prodi muamalat fakultas syariah dan hukum UIN Syarif Hidayatullah Jakarta)

0 22 0

Pendidikan Agama Islam Untuk Kelas 3 SD Kelas 3 Suyanto Suyoto 2011

4 108 178

ANALISIS NOTA KESEPAHAMAN ANTARA BANK INDONESIA, POLRI, DAN KEJAKSAAN REPUBLIK INDONESIA TAHUN 2011 SEBAGAI MEKANISME PERCEPATAN PENANGANAN TINDAK PIDANA PERBANKAN KHUSUSNYA BANK INDONESIA SEBAGAI PIHAK PELAPOR

1 17 40

KOORDINASI OTORITAS JASA KEUANGAN (OJK) DENGAN LEMBAGA PENJAMIN SIMPANAN (LPS) DAN BANK INDONESIA (BI) DALAM UPAYA PENANGANAN BANK BERMASALAH BERDASARKAN UNDANG-UNDANG RI NOMOR 21 TAHUN 2011 TENTANG OTORITAS JASA KEUANGAN

3 32 52