WL-2819 Autocreate indexes on site ID and hash.

This is because hibernate doesn't do index autocreation.
Not the redundant bit a little better.
Add .gitignores.
Make sure we always close the session.

Also reference the version of hibernate with problems.
Tidy up the gitignores.
Merge pull request #6 from ox-it/WL-2819

WL-2819 Create indexes on the hierarchy code.