开发者

Hibernate Insert Query in Java

Can anyone tell me how to perfor开发者_C百科m an insert query with Hibernate and back end postgresql I am using the following implementation but 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 simply try using persist without EntityManager (see this discussion).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜