Unidirectional Many to Many association mapping (without annotations)

In this post under Hibernate, I will explain how to create a unidirectional many to many association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `doctor1` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) NOT NULL DEFAULT ‘0’, `description`…… Continue reading Unidirectional Many to Many association mapping (without annotations)

Advertisements

Bidirectional One to One association mapping (without annotations)

In this post under Hibernate, I will explain how to create a bidirectional one to one association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `ticket2` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `number` VARCHAR(50) NOT NULL, `description` VARCHAR(100) NOT…… Continue reading Bidirectional One to One association mapping (without annotations)

Unidirectional One to One association mapping (without annotations)

In this post under Hibernate, I will explain how to create a unidirectional one to one association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `ticket1` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `number` VARCHAR(50) NOT NULL, `description` VARCHAR(100) NOT…… Continue reading Unidirectional One to One association mapping (without annotations)

Bidirectional One to Many association mapping (without annotations)

In this post under Hibernate, I will explain how to create a bidirectional one to many association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `series2` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) NOT NULL, `description` VARCHAR(100) NOT…… Continue reading Bidirectional One to Many association mapping (without annotations)

Unidirectional One to Many association mapping (without annotations)

In this post under Hibernate, I will explain how to create a unidirectional one to many association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `series1` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) NOT NULL, `description` VARCHAR(100) NOT…… Continue reading Unidirectional One to Many association mapping (without annotations)

Deleting a persisted object

In this post under hibrenate, I will explain how to delete a persisted object. We can delete a persisted object using Session interface delete method. Below is the complete code Main Class 1 import org.hibernate.Session; 2 import org.hibernate.SessionFactory; 3 4 public class HibernateDemo9 { 5 public static void main(String[] args) { 6 SessionFactory sessionFactory =…… Continue reading Deleting a persisted object

Saving a transient object

In this post of Hibernate ORM, I will explain how to save a transient object with an example. A transient object exists only in memory, no representation of it exists in database. Hibernate runtime doesn’t manage (ie., automatically update or sync up with database representation) the transient object. The object’s identifier property value will be…… Continue reading Saving a transient object