I guess the answer lies in the following lines of the
spec:
"While the container is not required to use the Serialization
protocol for the Java programming language to store the state of a passivated
session instance, it must achieve the equivalent result. The one exception is
that containers are not required to reset the value of transient fields during
activation[3]. Declaring the session bean's fields as transient is, in general,
discouraged.
--------------------------------------------------------------------------------------------------------------------
[3]
This is to allow the Container to swap out an instance's state through
techniques other than the Java programming language Serialization protocol. For
example, the Container's Java Virtual Machine implementation may use a block of
memory to keep the instance's variables, and the Container swaps the whole
memory block to the disk instead of performing Java programming language
Serialization on the instance."
Pay attention to the note (in
bold), in which the spec author clarifies that the container may
not use serialization as the storage mechanism, in which case, the
developer may not get the benefit of the keyword transient, i.e., the transient
variable may not get reinitialized!!!
-----Original Message-----
From: Ashwani Kalra [mailto:[EMAIL PROTECTED]]
Sent:
Tuesday, May 14, 2002 9:29 AM
To: [EMAIL PROTECTED]
Subject: Re:
Trade-offs between use of transient data and ejbPassivate
Hi
Krish
Yes I agree with you. But the question he is asking is that
why
the use of transient fields is discouraged ??
Ashwani
-----
Original Message -----
From: "Krishnan Subramanian"
<[EMAIL PROTECTED]>
To:
<[EMAIL PROTECTED]>
Sent: Monday, May 13, 2002 6:12
PM
Subject: Re: Trade-offs between use of transient data and
ejbPassivate
> Ashwani,
>
> Actually I believe
transient fields are to be used when:
>
> (a) The state
(fields) being held by the bean is not
>
serializable (either regular Java
serialization
> or IIOP serialization or
whatever custom serialization
> a Container
uses)
> (b) The field(s) though serializable may only have a
short
> [valid] lifespan. In which case, you
probably want to
> re-initialize/validate
them on every activation/passivation
>
cycle.
>
> -krish
>
> > -----Original
Message-----
> > From: A mailing list for Enterprise JavaBeans
development
> > [mailto:[EMAIL PROTECTED]]On
Behalf Of Ashwani Kalra
> > Sent: Monday, May 13, 2002 2:29 PM
>
> To: [EMAIL PROTECTED]
> > Subject: Re: Trade-offs between
use of transient data and ejbPassivate
> >
> >
> >
hi,
> > ejb specification 1.1 says that use of transient fields is
discouraged
> > refer page 52 of the pdf from Sun Microsystems
>
>
> > When I last read it, The reason may be that the
application programmer
is
> > then reponsible for initializing those
transient fields when ejbActivate
is
> > called.
> > Just
check it in the ejbActivate method description.
> > There is nothing
more to it
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
Thanks
> > Ashwani Kalra
> > http://www.geocities.com/ashwani_kalra/
> >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> >
> > -----
Original Message -----
> > From: "Shailendra Mishra"
<[EMAIL PROTECTED]>
> > To:
<[EMAIL PROTECTED]>
> > Sent: Monday, May 13,
2002 4:05 PM
> > Subject: Trade-offs between use of transient data and
ejbPassivate
> >
> >
> > hi guys,
>
>
> > could some one please point out the pros and cons of using
transient
> > fields in session beans and how different is it from
having
> > non-transient variables and writing the appropriate code in
ejbActivate
> > and ejbPassivate to handle the serializable
issue.
> >
> > ejb specification 1.1 says that use of
transient fields is discouraged
> > refer page 52 of the pdf from Sun
Microsystems.
> >
> > i am aware that making variables
transinet would not persist the data
> > and hence would give some
performance improvement. is there more to this
> > ?
>
>
> > expecting ur reply
> >
> > Shailendra
Mishra
> > MphasiS India
> > 'Apeego House', 4-B Tardeo
Road
> > Mumbai 400 034, INDIA
> > Tel: +91 22 491 4901 ext
1004
> > Fax: +91 22 496 1059
> > Dont think you are,
know you are - Morpheus
> >
> >
=======================
> > Getting Started:
> >
http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
>
> Community Web Site:
> > http://java.sun.com
> > List Archive:
>
> http://archives.java.sun.com/archives/j2eepatterns-interest.html
>
> Unsubscribing:
> > email "signoff J2EEPATTERNS-INTEREST" to
[EMAIL PROTECTED]
> >
>
>
===========================================================================
>
> To unsubscribe, send email to [EMAIL PROTECTED] and include in
the
body
> > of the message "signoff EJB-INTEREST". For
general help, send email to
> > [EMAIL PROTECTED] and include in
the body of the message "help".
> >
>
>
>
>
===========================================================================
>
To unsubscribe, send email to [EMAIL PROTECTED] and include in
the
body
> of the message "signoff EJB-INTEREST". For general
help, send email to
> [EMAIL PROTECTED] and include in the body of the
message
"help".
>
===========================================================================
To
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of
the message "signoff EJB-INTEREST". For general help, send email
to
[EMAIL PROTECTED] and include in the body of the message
"help".
