File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about ejbActivate and ejbPassivate

 
woo hwang
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a qeustion about ejbActivate and Passivate.
In the HFEJB 203page, When ejbPassivate completes, every non-transient instance variable MUST be a reference to one of the following.
...
A resource manager connection Factory(DataSource)
...

and the next page

a JDBC connection is not Serializable, so if you have one, you must set it to null in ejbPassivate().

My Question is that .JDBC connection is not Serializable. But it is a resource manager connection factory. is it?

I am not english native speaker... so i might misunderstand of this concept.
The things on the list (203page) are fine for activation and passivation. so I do not care of them.
Except the list, I need to care. One of them is JDBC connection.

If i am right, What is a resource manager connection factory?

cheers.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are mixing Datasource and Connection, from the JDBC API.
You can keep a reference to a Datasource (which provides connections), but not a reference to a Connection. The connection must be closed and cleared.
 
Steven Gao Song
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DataSource is also non-serializable.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DataSource is also non-serializable.

No, but it does not need to. For passivation, instances variables must be one of the following :

� A serializable object.
� A null.
� An enterprise bean's remote interface reference, even if the stub class is not serializable.
� An enterprise bean's remote home interface reference, even if the stub class is not serializable.
� An entity bean's local interface reference, even if it is not serializable.
� An entity bean's local home interface reference, even if it is not serializable.
� A reference to the SessionContext object, even if it is not serializable.
� A reference to the environment naming context (that is, the java:comp/env JNDI context) or any of its subcontexts.
� A reference to the UserTransaction interface.
A reference to a resource manager connection factory.
� An object that is not directly serializable, but becomes serializable by replacing the references
to an enterprise bean's home and component interfaces, the references to the SessionContext object, the references to the java:comp/env JNDI context and its subcontexts, and
the references to the UserTransaction interface by serializable objects during the object's serialization.
 
Shanthala Baleger
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how come we don't have primitive variable in the list?
example : int nSize = 10;
 
Shanthala Baleger
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-------------------------------
resource manager connection factory
------------------------------------

coudl you please give references to read and understand more about the "resource manager connection factory"?
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how come we don't have primitive variable in the list?

This list was taken from the EJB specification. I guess that because primitives are natively serializable, they don't need to be mentioned in the list.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic