usually one would leave getID() public, make setID(..) private and let hibernate generate the identifier like this
Code:
<class name="whatever" table="whatever">
<id name="id" column="id">
<generator class="native" />
</id>
</class>
there are a number of different generators (besides native) available, and you could even implement your own
alternatively you could not have a getID or setID property at in your domain object all like this
Code:
<class name="whatever" table="whatever">
<id column="id">
<generator class="native" />
</id>
</class>
you can then retrieve the id with session.getIdentifier, but because the ID is not in the object you can't detach/reatach these objects from a session