OK, here goes.
Code:
<hibernate-mapping>
<class name="eg.Person" table="Person">
<id name="id" type="java.lang.Long" unsaved-value="null"/>
<property name="name" type="string"/>
</class>
</hibernate-mapping>
The unsaved-value tells Hibernate that if the id is null, then the object should be considered transient (a new object) and that saveOrUpdate should save the new object via INSERT. If there is a value in the id property, then Hibernate should consider the object as persistent or detached (an object that already exists in the database) and that saveOrUpdate should save the object via UPDATE.
For most cases, the unsaved-value property default should suffice (the default unsaved-value for any Object is null, for primitives, it will be 0), and does not need to be specified in the mapping document explicitly.