Hi Gurus,
Code:
public static void main(String[] args) {
Session session = null;
try{
// This step will read hibernate.cfg.xml and prepare hibernate for use
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
//Create new instance of Contact and set values in it by reading them from form object
System.out.println("Inserting Record");
Contact contact = new Contact();
//contact.setId(7);
contact.setFirstName("Deepak");
contact.setLastName("Kumar");
contact.setEmail("deepak_38@yahoo.com");
session.save(contact);
System.out.println("Done");
}catch(Exception e){
System.out.println(e.getMessage());
}finally{
// Actual contact insertion will happen at this step
session.flush();
session.close();
}
}
I observed that with MySQL database, the insert operation perfectly works and i could verify the inserted values,
but with MS SQL even though the above code executes without any exceptions, i can see NULL tables values in database.
Does anybody haev any idea what might be going wrong ?
Thanks in advance,
Abhijit Salunkhe