Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The container serializes EntityManager, SessionContext even if they are not serializable?

 
Himai Minh
Ranch Hand
Posts: 1398
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p. 22 of Frits notes,

The following fields are serialized by the container:
- A reference to a Timer object
- A reference to SessionContext object,
- A reference to an EntityManager or EntityManagerFactory....



The JSR 318 says "even if they are not serializable".

So, how can the container serialize those fields which do not implement Serializable ?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2778
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, how can the container serialize those fields which do not implement Serializable ?

Good question for the EJB-container developers. However in the relation to the exam this knowledge is not needed.
 
Himai Minh
Ranch Hand
Posts: 1398
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I pass an object reference, which does not implement Serializable, as an argument to a remote method, the EJB container throws an exception saying that object is not serializable.

I think the EJB container can still serialize a non-serializable object.
 
Himai Minh
Ranch Hand
Posts: 1398
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just got a reply from Enthuware http://www.enthuware.com/forum/viewtopic.php?f=4&t=861

The container can use externalization, re create the object like EntityManager that does not implement Serializable interface
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!