I think that the idea is good but you have to change something.
If you want to use lazy loading you've to enforce that the ejbLoad() clears
your subject attribute.
Indeed, if you have another concurrent transaction (not using the Enrollment
component) which is changing the subject foreign key, your bean reference
becomes invalid.
Clearing the subject attribute forces the component to reload the right
reference. So, the subject's reference is reloaded between two transactions
but stays cached during the transaction.
Regis Le Brettevillois
CTO
LIBeLIS
http://www.libelis.com
-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]De la part de Blasius Lofi
Dewanto
Envoye : vendredi 30 mars 2001 13:47
A : [EMAIL PROTECTED]
Objet : Re: Error in JOnAS 2.2.7
> First, you are assuming that the EJB container initialize a new object
each
> time it has to provide a new implementation for a component contract. But,
> depending of the container implementation it can be true or false.
WebLogic,
> for example, uses pool of objects. JOnAS doesn't provide a new instance
> anymore.
Yes, you're right.
> Second, your "lazy load" technic doesn't take care about transaction
> isolation. Indeed, the ejbLoad() is called the first time you call the
bean
> in a transaction. In pessimistic locking ejbLoad() has to get data from
the
> database and lock the tuple in the database. If you delay the load in a
> service (method) the data can be inconsistent regarding the transactional
> state.
So you're saying, that I have to load all the
calculated data in ejbLoad() directly?
If, let's say, the container uses a pessimistic locking,
it will only lock the data from its table but not other
table. In my example (see my mail before),
the container will lock the table "Enrollment" but
doesn't lock the table "subject".
So I think, it's okay, if I use this lazy loading
and also init the transient variable at the ejbLoad().
Do I miss something?
Thanx,
--
---------------------------------------------------
Blasius Lofi Dewanto
---------------------------------------------------
OpenUSS - Open University Support System
http://openuss.sourceforge.net
---------------------------------------------------
E-Mail : [EMAIL PROTECTED]
ICQ : 39343280
---------------------------------------------------
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
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 "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".