database - Hibernate Insert Query in Java -
can tell me how perform insert query hibernate , end postgresql using following implementation not working
session session = gileadhibernateutil.getsessionfactory().opensession(); session.begintransaction(); user a= new user(); a.setid(67); a.setfirstname("noor"); a.setlastname("asd"); a.setmobilenumber("2435"); a.settelephonenumber("dfg"); session.save(a); session.gettransaction().commit();
as matt ball suggested, try using entitymanager.persist(java.lang.object entity)
(see here) instead. or try using persist without entitymanager (see discussion).
Comments
Post a Comment