aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Question about ejbActivate and ejbPassivate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Question about ejbActivate and ejbPassivate" Watch "Question about ejbActivate and ejbPassivate" New topic
Author

Question about ejbActivate and ejbPassivate

woo hwang
Greenhorn

Joined: Dec 13, 2006
Posts: 23
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Steven Gao Song
Ranch Hand

Joined: Oct 02, 2006
Posts: 78
DataSource is also non-serializable.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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

Joined: Nov 18, 2006
Posts: 14
how come we don't have primitive variable in the list?
example : int nSize = 10;
Shanthala Baleger
Greenhorn

Joined: Nov 18, 2006
Posts: 14
-------------------------------
resource manager connection factory
------------------------------------

coudl you please give references to read and understand more about the "resource manager connection factory"?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about ejbActivate and ejbPassivate