• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

JPA Idclass - why it is Serializable

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
One fundamental/dumb question, why IdClass should implement Serializable? Why Embeddable class is not Serializable?
Thanks
Eswar
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Eswar Kaligotla wrote:Hi all,
One fundamental/dumb question, why IdClass should implement Serializable? Why Embeddable class is not Serializable?
Thanks
Eswar



Hi,

I've not found an exhaustive explanation on the subject but here my two pennies:

idClass is annotated at the Class level, whereas EmbeddedId is used at method or field level. If i remember
correctly, serializable is used by Entity classes when sending the object remotely, so, what i think is that
for EmbeddedId, since they are annotated inside the entity, if the entity is serializable it might take care
of the embedded class as well.

For the idClass, since the annotation is at the class level, maybe the Entity serializable interface cannot
be applied and therefore, the idClass has to take care on his own for the serialization part.

Maybe the reason to make it a requirement for the idClass to be serializable is to make it safe for the use
that will be done later...like being sent remotely...

Don't take this as a final answer, as this is are just a couple of thoughts until some expert on the matter
will shed some light on this ;)

Dave


 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic