I\'ve been looking at various hibernate tutorials and samples, for their identity/primary key property, some use a Java primitive type, some uses the wrapper type, that is;<
I prefer using the wrapper types, because otherwise, when we use primitive types, the primary key id will be set to 0 by default, and 0 could be the value of an actual id column in the corresponding table of the entity, and this can sometimes lead to hard to pinpoint bugs.
But using a wrapper, the default value of id will be null and a primary key column cannot have a null value, thus you can't update an entity that its id value is not set with a valid value by your application's logic.