If the Hibernate framework ever needs to "passivate" as composite key by saving its state temporarily to the hard drive, or even send the data across a network or io connection, the fact that the bean is serializable means that the framework can perform these tasks by using standard Java mechanisms. If the bean is not serializable, Hibernate cannot depend on the built-in serialization features of the JVM.
Joined: Aug 18, 2008
but why only with composite primary key.?
if i have primary key member specifed in a class , which is not serializable...then also hibernate framework works
Cameron Wallace McKenzie
author and cow tipper
An int is a primitive type. The Serializable commitment is essentially that an object is only made up of the basic primitive types, and if there are non-primitive types, those types be either Serializable or be marked as transient.
All the primitive types are essentially 'serializable', as the JVM can write and read them to various output streams. Of course, technically we can't call primitives "Serializable" because they are not object, but they sorta are.