Friday, July 29, 2011

HIBERNATE Examples - Step 1. Database Creation

The examples are all done using MYSQL database.

The following is the schema that is used for developing the examples.

CREATE TABLE DEPARTMENTS (
 DEPT_ID INTEGER(2) PRIMARY KEY, 
 NAME VARCHAR(20),
 YEAR_STARTED VARCHAR(4));

CREATE TABLE STUDENTS (
 STUDENT_ID INTEGER(5) PRIMARY KEY,
 NAME VARCHAR(30),
 AGE INTEGER(2),
 ADDRESS VARCHAR(50),
 DEPT_ID INTEGER(2),
 FOREIGN KEY (DEPT_ID) REFERENCES DEPARTMENTS(DEPT_ID)); 
 
COMMIT;

No comments:

Post a Comment