The largest Interview Solution Library on the web


Hibernate Tutorials/
« Previous | 1 | 2 | 3 | Next »
Here are the steps to compile and run the above mentioned application. Make sure you have set PATH and CLASSPATH appropriately before proceeding for the compilation and execution.

  • Delete Employee.hbm.xml mapping file from the path.
  • Create Employee.java source file as shown above and compile it.
  • Create ManageEmployee.java source file as shown above and compile it.
  • Execute ManageEmployee binary to run the program.

You would get following result, and records would be created in EMPLOYEE table.

$java ManageEmployee
.......VARIOUS LOG MESSAGES WILL DISPLAY HERE........

FirstName:ZaraLastName:AliSalary:1000
FirstName:DaisyLastName:DasSalary:5000
FirstName:JohnLastName:PaulSalary:10000
FirstName:ZaraLastName:AliSalary:5000
FirstName:JohnLastName:PaulSalary:10000

If you check your EMPLOYEE table, it should have following records:

mysql>select*from EMPLOYEE;
+----+------------+-----------+--------+
|id| first_name | last_name | salary |
+----+------------+-----------+--------+
|29|Zara|Ali|5000|
|31|John|Paul|10000|
+----+------------+-----------+--------+
2 rows inset(0.00 sec
mysql>

Here are the steps to compile and run the above mentioned application. Make sure you have set PATH and CLASSPATH appropriately before proceeding for the compilation and execution.

  • Create hibernate.cfg.xml configuration file as explained in configuration chapter.
  • Create Employee.hbm.xml mapping file as shown above.
  • Create Employee.java source file as shown above and compile it.
  • Create ManageEmployee.java source file as shown above and compile it.
  • Execute ManageEmployee binary to run the program.

You would get following result, and records would be created in EMPLOYEE table.

$java ManageEmployee
.......VARIOUS LOG MESSAGES WILL DISPLAY HERE........

FirstName:DaisyLastName:DasSalary:5000
FirstName:JohnLastName:PaulSalary:5000
FirstName:MohdLastName:YaseeSalary:3000
TotalCoint:4
TotalSalary:15000

If you check your EMPLOYEE table, it should have following records:

mysql>select*from EMPLOYEE;
+----+------------+-----------+--------+
|id| first_name | last_name | salary |
+----+------------+-----------+--------+
|14|Zara|Ali|2000|
|15|Daisy|Das|5000|
|16|John|Paul|5000|
|17|Mohd|Yasee|3000|
+----+------------+-----------+--------+
4 rows inset(0.00 sec)
mysql>
Here are the steps to compile and run the above mentioned application. Make sure you have set PATH and CLASSPATH appropriately before proceeding for the compilation and execution.

  • Create hibernate.cfg.xml configuration file as explained above.
  • Create Employee.hbm.xml mapping file as shown above.
  • Create Employee.java source file as shown above and compile it.
  • Create ManageEmployee.java source file as shown above and compile it.
  • Execute ManageEmployee binary to run the program which will create 100000 records in EMPLOYEE table.

Here are the steps to compile and run the above mentioned application. Make sure you have set PATH and CLASSPATH appropriately before proceeding for the compilation and execution.

  • Create hibernate.cfg.xml configuration file as explained in configuration chapter.
  • Create Employee.hbm.xml mapping file as shown above.
  • Create Employee.java source file as shown above and compile it.
  • Create MyInterceptor.java source file as shown above and compile it.
  • Create ManageEmployee.java source file as shown above and compile it.
  • Execute ManageEmployee binary to run the program.

You would get following result, and records would be created in EMPLOYEE table.

$java ManageEmployee
.......VARIOUS LOG MESSAGES WILL DISPLAY HERE........

CreateOperation
preFlush
postFlush
CreateOperation
preFlush
postFlush
CreateOperation
preFlush
postFlush
FirstName:ZaraLastName:AliSalary:1000
FirstName:DaisyLastName:DasSalary:5000
FirstName:JohnLastName:PaulSalary:10000
preFlush
postFlush
preFlush
UpdateOperation
postFlush
preFlush
postFlush
FirstName:ZaraLastName:AliSalary:5000
FirstName:JohnLastName:PaulSalary:10000
preFlush
postFlush

If you check your EMPLOYEE table, it should have following records:

mysql>select*from EMPLOYEE;
+----+------------+-----------+--------+
|id| first_name | last_name | salary |
+----+------------+-----------+--------+
|29|Zara|Ali|5000|
|31|John|Paul|10000|
+----+------------+-----------+--------+
2 rows inset(0.00 sec
mysql>
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com