I am using Spring MVC + Hibernate
@Resource(name = \"sessionFactory\") private SessionFactory sessionFactory; // save public int
Try this instead. This works with latest Hibernate (version 4.1) also.
session.persist(object); object.getId();