Java Hibernate - Part 3- Annotations Example
Program to add Customer details in to MySQL Database using Hibernate 3.2 . Requirements: Eclipse Keplor, MySQL 5.5,mysql-connector-odbc-5.2.5, Hibernate 3.2 (jars and xml files). Steps create a new java project named Sample1 add all hibernate jars to project build path. copy hibernate.cfg.xml to src folder Open MySQL command prompt create Test database and use it. create Table named customer. create table customer(cid int primary key auto_increment,cname varchar(20),email varchar(20),phone varchar(15),city varchar(15),bal double); create a package named com.sam.hibernatefiles and write the following Customer.java(Hibernate Persistence class) HibernateUtil.java write the following client side code under package com.sam.hibernatefiles. Lab1A Customer.java package com.sam.hibernatefiles; import javax.persistence.*; @Entity @Table(name="customer") public class Customer { @Id @GeneratedValue(strategy=GenerationType.AUT...