Академический Документы
Профессиональный Документы
Культура Документы
Objectives
Updating Objects
For example:
..............
..............
transaction.begin();
Employee
empUpdate=(Employee)session.load(Employee.class,
objID);
empUpdate.setAddress("Hudson Street, California");
session.update(empUpdate);
transaction.commit();
Updates
Assigns the empUpdate object
the empUpdate object ainnew
the database
employee by using the
address.
update() method.
Deleting Objects
For example:
..............
..............
transaction.begin();
Employee
empUpdate=(Employee)session.load(Employee.class,
objID);
session.delete(empUpdate);
transaction.commit();
Just a minute
Solution:
Serializable
Problem Statement:
The Grant University website contains a registration page that
allows the students to register themselves on the website. The
registration page consists of fields that accept data from the
students. When a students clicks the submit button on this
page after entering the required data, the details provided by
the students should be stored in the database. In addition, a
success page should be displayed showing a welcome
message and the user ID of the student.
You have been assigned the task to implement the preceding
functionality in the Grant University website. How will you
accomplish this task?
Solution:
To complete the preceding assignment, you need to perform
the following tasks:
1. Create a class for saving the student data.
2. Modify the RegistrationForm.java file.
3. Modify the Registration.xhtml file.
4. Execute the application.
Implementing Transactions
Properties of a Transaction
Summary
Summary (Contd.)