Persistent Object Identity JMX Integration Obtaining a SessionFactory

applications 291 application and not yet persisted or they may have been instantiated by a closed Session. Transaction Optional. A single-threaded, short-lived object used by the application to specify atomic units of work. Abstracts application from underlying JDBC, JTA or CORBA transaction. A Session might span several Transactions. ConnectionProvider Optional. A factory for and pool of JDBC connections. Abstracts application from underlying Data-source or DriverManager. Not exposed to application. TransactionFactory Optional. A factory for Transaction instances. Not exposed to the application.

1.2 Persistent Object Identity

The application may concurrently access the same persistent state in two different sessions. However, an in-stance of a persistent class is never shared between two Session instances. Hence there are two different no-tions of identity: Table 1- Persistent Object Identity Persistent Identity JVM Identity foo.getId.equalsbar.getId foo==bar Then for objects returned by a particular Session, the two notions are equivalent. However, while the applica-tion might concurrently access the same persistent identity business object in two different sessions, the two instances will actually be different JVM identity. This approach leaves Hibernate and the database to worry about concurrency the application never needs to synchronize on any business object, as long as it sticks to a single thread per Session or object identity within a session the application may safely use == to compare objects.

1.3 JMX Integration

JMX is the J2EE standard for management of Java components. Hibernate may be managed via a JMX stan-dard MBean but because most application servers do not yet support JMX, Hibernate also affords some non-standard configuration mechanisms. 2 Configuring SessionFactory Hibernate is designed to operate in many different environments and this results in a large number of configuration parameters. In order to help the developer, Hibernate is distributed with an example of hibernate.properties file that shows various options available. When configuring Hibernate you have two options, either user programmatic configuration or load a hibernate.properties file where the configuration is already applications 292 specified. We will not present those in this paper, but if you want to see more information on this, please take a look in hibernate_reference.pdf which is included in Hibernate 2.0.2 distribution.

2.1 Obtaining a SessionFactory

After loading the configuration, your application must obtain a factory for session instances. The obtained factory is intended to be used by all application threads. Anyway if you are working with more than one database, Hibernate allows your application to instantiate more than one SessionFactory. Code sample 1 - Obtaining a SessionFactory SessionFactory sessions=cfg.buildSessionFactory;

2.2 Database connection

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