We
then simply have to call the save() method, passing it the User object, and finally call commit()
on the transaction, which we obtain via a call to session.getTransaction(). That??™s it! Notice
there is no SQL anywhere to be found, and we didn??™t have to actually tell Hibernate specifically
what to do. It knows how to map the User object to the underlying database tables and knows
how to create the correct SQL statements to accomplish this (remember, Hibernate is, of
course, using JDBC at the end of the day). Very nifty, and if this is your first encounter with
Hibernate, you should now be suitably impressed!
Lastly, you can see the call to Utils.callUpdateData(), which is the reverse Ajax method
we saw earlier, so at this point all users currently using Timekeeper will have their displays
updated with the change to the user list.
updateUser():Or,Why Is Your Wife Still Trying to Change You?!?
The next method is similar, but different, and is for updating existing users:
@RemoteMethod
public void updateUser(final String inFieldToUpdate, final long inID,
final String inNewValue) throws Exception {
if (log.isTraceEnabled()) {
log.trace("updateUser() - Entry");
}
if (log.
Pages:
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871