Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Preparing table for HQL Examples

In this lesson we will create insurance table and populate it with the data.


When should you use Hibernate? What's new in Hibernate 5? How much time it takes to learn Hibernate? Hibernate envers custom revinfo table Hibernate 5 Envers Hibernate Envers get all revisions Hibernate Examples Hibernate 5 build SessionFactory Example Hibernate 5 SessionFactory Example Hibernate 5 Annotation Example How to download Hibernate 5.x? Hibernate 5 Features Hibernate 5 Tutorials Learning Hibernate ORM - Free Training/Tutorial videos of Hibernate ORM with Java How to write hello world example program in Hibernate? How to create one to one relationship in Hibernate 4 with Annotation? How to calculate minimum in Hibernate using the min() Function Hibernate ORM 4.2.21.Final Released - Create CURD application in latest Hibernate Hibernate ORM 4.2.21 Tutorial - Learn Hibernate ORM Framework Hibernate Error: Failed to create sessionFactory How to create Hibernate Project in Eclipse? Examples of Hibernate Criteria Query Hibernate ORM 4.3.6.Final released Hibernate ORM 4.2.14.Final released Hibernate 4.3.4 Released: Hibernate 4.3.4.Final Maven dependency Hibernate association and join example Learn Hibernate programming with Examples Introduction to Hibernate Framework Hibernate Tutorial: Learn Hibernate with examples Hibernate 4.3 Hello World: Example Hibernate ORM 4.3.1.Final released How to create SessionFactory in Hibernate 4.3.1? Hibernate 4 Hello World: Example of Hello World program Hibernate 4 create Session Factory: Example of creating Session Factory in Hibernate 4 Hibernate 4.3 and JPA 2.1 Example What is Hibernate in Java? Hibernate Overview and Architecture What is JPA 2.1? Hibernate 4.3.0.Final Maven dependency Hibernate 4.3 ORM Features Hibernate 4.3 Tutorial Hibernate Criteria average example Hibernate Criteria load all objects from table Hibernate Criteria Hibernate ORM 4.3.0.Final released Hibernate beginner tutorial Hibernate Session.delete() Example Hibernate save or update method example Hibernate Load Example Hibernate save Example - Rose India Hibernate 4 tutorials

Preparing table for HQL Examples


In this lesson we will create insurance table and populate it with the data. We will use insurance table for rest of the HQL tutorial.

To create the insurance table and insert the sample data, run the following sql query:

/*Table structure for table `insurance` */

drop table if exists `insurance`;

CREATE TABLE `insurance` (
  `ID` int(11) NOT NULL default '0',
  `insurance_name` varchar(50) default NULL,
  `invested_amount` int(11) default NULL,
  `investement_date` datetime default NULL,

/*Data for the table `insurance` */

insert into `insurance` values 
(1,'Car Insurance',1000,'2005-01-05 00:00:00');
insert into `insurance` values 
(2,'Life Insurance',100,'2005-10-01 00:00:00');
insert into `insurance` values 
(3,'Life Insurance',500,'2005-10-15 00:00:00');
insert into `insurance` values 
(4,'Car Insurance',2500,'2005-01-01 00:00:00');
insert into `insurance` values 
(5,'Dental Insurance',500,'2004-01-01 00:00:00');
insert into `insurance` values
 (6,'Life Insurance',900,'2003-01-01 00:00:00');
insert into `insurance` values 
(7,'Travel Insurance',2000,'2005-02-02 00:00:00');
insert into `insurance` values 
(8,'Travel Insurance',600,'2005-03-03 00:00:00');
insert into `insurance` values 
(9,'Medical Insurance',700,'2005-04-04 00:00:00');
insert into `insurance` values 
(10,'Medical Insurance',900,'2005-03-03 00:00:00');
insert into `insurance` values 
(11,'Home Insurance',800,'2005-02-02 00:00:00');
insert into `insurance` values 
(12,'Home Insurance',750,'2004-09-09 00:00:00');
insert into `insurance` values 
(13,'Motorcycle Insurance',900,
'2004-06-06 00:00:00');
insert into `insurance` values 
(14,'Motorcycle Insurance',780
,'2005-03-03 00:00:00');

Above Sql query will create insurance table and add the following data:

ID insurance_name invested_amount investement_date
1 Car Insurance 1000 2005-01-05 00:00:00
2 Life Insurance 100 2005-10-01 00:00:00
3 Life Insurance 500 2005-10-15 00:00:00
4 Car Insurance 2500 2005-01-01 00:00:00
5 Dental Insurance 500 2004-01-01 00:00:00
6 Life Insurance 900 2003-01-01 00:00:00
7 Travel Insurance 2000 2005-02-02 00:00:00
8 Travel Insurance 600 2005-03-03 00:00:00
9 Medical Insurance 700 2005-04-04 00:00:00
10 Medical Insurance 900 2005-03-03 00:00:00
11 Home Insurance 800 2005-02-02 00:00:00
12 Home Insurance 750 2004-09-09 00:00:00
13 Motorcycle Insurance 900 2004-06-06 00:00:00
14 Motorcycle Insurance 780 2005-03-03 00:00:00

In the future lessons we will use this table to write different HQL examples.


Share on Google+Share on Google+

Preparing table for HQL Examples

Posted on: January 19, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Preparing table for HQL Examples   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
July 11, 2012
About travelling a page

Next or previous button is not working for the lower column of the page preparinginsurancedatabase.shtml