Query q = em.createNativeQuery("INSERT INTO image(ext, modified_on, modified_by, url, url_thumb) VALUES(?, ?, ?, ?, ?) RETURNING *", Image.class);
q.setParameter(1, "jpg");
q.setParameter(2, new Date());
q.setParameter(3, 1274);
q.setParameter(4, "NULL");
q.setParameter(5, null);
Image img = (Image) q.getSingleResult();