This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primitive/ Arrays in ejbPassivate()

 
Natarajan Shankar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
During ejbPassivate() said it can take serializable object for passivation without any alteration. How about primitives/ arrays? They are serializable auto?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of the many reasons why the SCJP exam is a prerequisite for the SCBCD certification...

Section 10.8 of the JLS states:

The direct superclass of an array type is Object. Every array type implements the interfaces Cloneable and java.io.Serializable.


Which means that arrays are serializable by nature and are thus concerned by the first bullet of section 7.4.1 of the EJB specification

I hope this helps
 
Natarajan Shankar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok Valentin, thanks for the reference so you mean primitives are not serializable?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did I mention that? I don't think so

Actually, the serialization of primitive types is supported by default by any JVM, so you don't need to do anything special for that...

For the same reason, arrays of primitive types are also serializable.

Hope this helps
 
Natarajan Shankar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I was also having same assumption. But I was wondering my assumption is correct or not. For this reason only I was looking into some documents and also in my earlier question I meant as primitive array. Thanks for the support.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem, it's cool
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic