Session s = openSession();
Transaction t = s.beginTransaction();
IntegerVersioned entity = new IntegerVersioned( "int-vers" );
s.save( entity );
s.createQuery( "select id, name, version from IntegerVersioned" ).list();
t.commit();
s.close();
Long initialId = entity.getId();
int initialVersion = entity.getVersion();