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)

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