Problem in this "FirstExample" class,
December 18, 2008 at 6:40 AM
There is a problem. In this "FirstExample" class session =sessionFactory.openSession(); //Create new instance of Contact and set
//Here transaction should begin.
Transaction trx = session.beginTransaction();
values in it by reading them from form object System.out.println("Inserting Record"); Contact contact = new Contact(); contact.setId(3); contact.setFirstName("Deepak"); contact.setLastName("Kumar"); contact.setEmail("firstname.lastname@example.org"); session.save(contact);
// Transaction should be commited here
If we dont mention the transaction the database will not update.
In this "FirstExample" class Transaction commit is missing. Please update the class. It is very helpful for the beginners.
View All Comments
| View Tutorial