Skip to content

dimmonn/HibernateTutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

Hibernate Simple Tutorial

Hibernate Simple Tutorial using spring transactions

Installation

  1. install mysql db with "dnName" database name
  2. set up username and a password with privs granted to the dbName
  3. update spring.xml file like below

<property name="driverClassName" value="com.mysql.jdbc.Driver" />

<property name="url" value="jdbc:mysql://ip:3306/dbName" />

<property name="username" value="root" />

<property name="password" value="pass" />

relations of the tables being updated by this tutorial is below img

Run

  1. run the library like below

##java -jar SpringWithHibernate-Version.jar "usage",

#####where usage is:

usage: Main
-ae,--addEmpl Add an employee to an existing dept (ex. -ae "employee id")
-ed,--editDept Edit an existing dept (ex. -ed "department id")
-fe,--findEmpl Find emp by id (ex. -fe "employee id")
-fn,--findDept Find dept by id (ex. -fn "department id")
-h,--help show help
-nd,--addDept Add new dept (ex. -nd "department name")
-re,--removeEmp remove emp by id (ex. -re "employee id")
-rm,--removeDept Remove an existing dept (ex. -rm "department id")
-sh,--showDept Show an existing dept (ex. -sh "department id")