Its enough to put it to the UserID however its not a bad idea to have your entities serialaizable so that in case your web app. is used in a distributed environment then your objects will be able to move from one VM to another without problems. ;)

omar al kababji wrote:Its enough to put it to the UserID however its not a bad idea to have your entities serialaizable so that in case your web app. is used in a distributed environment then your objects will be able to move from one VM to another without problems. ;)

(peace)

I believe that it's a requirement that the Primary Keys of any entity must be serializable.

regards,

Omar Al Kababji

Ranch Hand

Posts: 357

posted 9 years ago

Angel Taveras wrote:

I believe that it's a requirement that the Primary Keys of any entity must be serializable.

regards,

yes thats exactly what i meant by its enough for the UserId which is the primary key ;), actually if you look at the load or get methods of the session object of hibernate you will notice that the second parameter that is the primary key should be serializable.

however its not bad to always make your classes serializable if you can, since many frameworks depends on that to move objects back and forth on the network in distributed applications ;)