Event e = new Event(); e.setName("test"); session.save(e);
Event e = (Event) session.createQuery(" from Event e where e.name = 'test' ").uniqueResult(); if (null == e) { e = new Event(); e.setName("test"); session.save(e); }
    private void createEvent()    {        event = (Event) ht.execute(new HibernateCallback()        {            public Object doInHibernate(org.hibernate.Session session)                throws org.hibernate.HibernateException, java.sql.SQLException            {                Event e = new Event();                e.setName("test");                session.save(e);                                return e;            }        });    }