sess.createSQLQuery(“INSERT INTO ARCHIVE (folder) VALUES(:folder)”) .setParameter(“folder”,path) .executeUpdate();
我想要新创建对象的ID。我怎样才能做到这一点?
试试吧
Integer lastId = (Integer) session.createSQLQuery(“SELECT LAST_INSERT_ID()”) .uniqueResult();